Sage100-vps/schemas/tiers/fournisseurs.py
2026-01-08 16:58:43 +03:00

79 lines
2.7 KiB
Python

from pydantic import BaseModel, Field, EmailStr
from typing import Optional
from schemas.tiers.tiers import TiersDetails
class FournisseurDetails(TiersDetails):
class Config:
json_schema_extra = {
"example": {
"numero": "FOU000001",
"intitule": "SARL FOURNISSEUR",
"type_tiers": 1,
"commercial_code": 1,
"commercial": {
"numero": 1,
"nom": "MARTIN",
"prenom": "Sophie",
"email": "s.martin@entreprise.fr",
},
}
}
class FournisseurCreate(BaseModel):
intitule: str = Field(
..., min_length=1, max_length=69, description="Raison sociale du fournisseur"
)
compte_collectif: str = Field(
"401000", description="Compte comptable fournisseur (ex: 401000)"
)
num: Optional[str] = Field(
None, max_length=17, description="Code fournisseur souhaité (optionnel)"
)
adresse: Optional[str] = Field(None, max_length=35)
code_postal: Optional[str] = Field(None, max_length=9)
ville: Optional[str] = Field(None, max_length=35)
pays: Optional[str] = Field(None, max_length=35)
email: Optional[EmailStr] = None
telephone: Optional[str] = Field(None, max_length=21)
siret: Optional[str] = Field(None, max_length=14)
tva_intra: Optional[str] = Field(None, max_length=25)
class Config:
json_schema_extra = {
"example": {
"intitule": "ACME SUPPLIES SARL",
"compte_collectif": "401000",
"num": "FOUR001",
"adresse": "15 Rue du Commerce",
"code_postal": "75001",
"ville": "Paris",
"pays": "France",
"email": "contact@acmesupplies.fr",
"telephone": "0145678901",
"siret": "12345678901234",
"tva_intra": "FR12345678901",
}
}
class FournisseurUpdate(BaseModel):
intitule: Optional[str] = Field(None, min_length=1, max_length=69)
adresse: Optional[str] = Field(None, max_length=35)
code_postal: Optional[str] = Field(None, max_length=9)
ville: Optional[str] = Field(None, max_length=35)
pays: Optional[str] = Field(None, max_length=35)
email: Optional[EmailStr] = None
telephone: Optional[str] = Field(None, max_length=21)
siret: Optional[str] = Field(None, max_length=14)
tva_intra: Optional[str] = Field(None, max_length=25)
class Config:
json_schema_extra = {
"example": {
"intitule": "ACME SUPPLIES MODIFIÉ",
"email": "nouveau@acme.fr",
"telephone": "0198765432",
}
}