feat: montador Interno and Venda, Tiny customers, brand per stamp (front 7a.3, Marcus 10/11)

Interno: the Expedição assembles the marketplace's own sales on the fixed
internal customer Gestão fills in once; no Tiny order, no paid e-mail,
marked interno, it stays in house. Venda: a Vendedor or Gestão picks the
customer from the Tiny base and the order goes to Tiny like an approved
quote, faturado (Boleto from TINY_RECEIPT_BOLETO when set), pickup or
'junto com o pedido de roupa nº X'. Números counts both at table price,
apart from cash (and the average ticket over cash orders only). Each stamp
can carry a brand and a public flag for the future catalogue.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-11 11:01:44 -03:00
parent e6197d6e40
commit b5a51137fb
15 changed files with 710 additions and 97 deletions

View File

@@ -289,16 +289,26 @@ class QuoteRequest(StrictModel):
return self
class MontadorOrder(StrictModel):
"""What the montador sends (front 7a.2b): the typed customer, pickup only
and loose artwork only; the server prices and approves it as a quote."""
"""What the montador sends (front 7a.3): Interno or Venda, loose artwork
only and pickup; the server prices and approves it as a quote. An Interno
order takes the fixed customer from the database, a Venda one the customer
picked from Tiny."""
request_key: UUID
customer: Customer
kind: Literal['interno', 'venda']
# Empty for an Interno order: the server reads the internal customer.
customer: Customer | None = None
items: list[Item] = Field(min_length=1, max_length=30)
# A Venda that travels with the customer's clothing order; pickup freight.
with_order: int | None = Field(default=None, ge=1, le=999999, strict=True)
@model_validator(mode='after')
def loose_art_only(self):
def order_kind(self):
if any(item.mode != 'avulsa' for item in self.items):
raise ValueError('O montador só monta artes avulsas.')
if self.kind == 'venda' and self.customer is None:
raise ValueError('O pedido de venda precisa do cliente.')
if self.kind == 'interno' and self.with_order is not None:
raise ValueError('O pedido interno não tem envio.')
return self
class Review(StrictModel):
@@ -528,3 +538,9 @@ class StampSizeTable(StrictModel):
if len(letters) != len(set(letters)):
raise ValueError('Cada tamanho tem uma letra própria.')
return self
class StampBrand(StrictModel):
"""The brand recorded per stamp code, for the future catalogue (front 7a.3)."""
brand: str = Field(default='', max_length=120)
public: bool = False