Merge main into label
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -174,7 +174,7 @@ def check_splits(items):
|
||||
|
||||
|
||||
class Item(StrictModel):
|
||||
mode: Literal['file','avulsa','uvfile','uv']
|
||||
mode: Literal['file','avulsa','uvfile','uv','premium']
|
||||
metres: Decimal = Field(gt=0, le=12000)
|
||||
grade: int = Field(ge=0, le=100, strict=True)
|
||||
uploads: list[UUID] = Field(min_length=1, max_length=20)
|
||||
@@ -205,7 +205,7 @@ class Item(StrictModel):
|
||||
raise ValueError('Only loose artwork is split into sheets')
|
||||
if [source.upload_id for source in self.production.sources] != self.uploads:
|
||||
raise ValueError('Production sources must match uploaded files in order')
|
||||
is_sheet = self.mode in ('file', 'uvfile')
|
||||
is_sheet = self.mode in ('file', 'uvfile', 'premium')
|
||||
# UV is 27 cm wide (Dropstar, 2026-10-28; it was 28,5).
|
||||
film_width = Decimal('27') if self.mode in ('uvfile', 'uv') else Decimal('57')
|
||||
if self.production.film_width_cm != film_width:
|
||||
@@ -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):
|
||||
@@ -396,7 +406,7 @@ class CouponNew(StrictModel):
|
||||
min_metres: Decimal | None = Field(default=None, gt=0, decimal_places=1)
|
||||
max_uses: int | None = Field(default=None, gt=0, strict=True)
|
||||
max_uses_per_customer: int | None = Field(default=None, gt=0, strict=True)
|
||||
product: Literal['file', 'avulsa', 'uvfile', 'uv'] | None = None
|
||||
product: Literal['file', 'avulsa', 'uvfile', 'uv', 'premium'] | None = None
|
||||
note: str = Field(default='', max_length=1000)
|
||||
|
||||
|
||||
@@ -409,7 +419,7 @@ class CouponUpdate(StrictModel):
|
||||
min_metres: Decimal | None = Field(default=None, gt=0, decimal_places=1)
|
||||
max_uses: int | None = Field(default=None, gt=0, strict=True)
|
||||
max_uses_per_customer: int | None = Field(default=None, gt=0, strict=True)
|
||||
product: Literal['file', 'avulsa', 'uvfile', 'uv'] | None = None
|
||||
product: Literal['file', 'avulsa', 'uvfile', 'uv', 'premium'] | None = None
|
||||
note: str | None = Field(default=None, max_length=1000)
|
||||
paused: bool | None = None
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -8,7 +8,7 @@ import os
|
||||
import re
|
||||
from decimal import Decimal, ROUND_CEILING
|
||||
|
||||
PRICES = {'file': 1990, 'avulsa': 2190, 'uvfile': 7990, 'uv': 8990}
|
||||
PRICES = {'file': 1990, 'avulsa': 2190, 'uvfile': 7990, 'uv': 8990, 'premium': 3990}
|
||||
|
||||
# A finished sheet the Site cannot open (CDR, AI, PSD, TIFF) is opened by a
|
||||
# person before printing. It pays this per metre on top of the product's price
|
||||
|
||||
Reference in New Issue
Block a user