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

@@ -60,18 +60,19 @@ def is_test(order):
# (Dropstar's rule D-35, 2026-10-26; the user's answers of 2026-10-27).
MANUAL_PROVIDER = 'manual'
OUTSIDE_METHODS = ('pix', 'card', 'cash', 'credit')
# A montador order is invoiced, not paid at the counter: it is not one of the
# Cotações "registrar" methods.
# A montador Venda order is invoiced, not paid at the counter: it is not one of
# the Cotações "registrar" methods. It goes to Tiny as an approved quote does.
INVOICED_METHOD = 'faturado'
# A montador Interno order: the marketplace's own sale, already invoiced there.
# It stays in house and never reaches Tiny (Marcus, 2026-11-10).
INTERNAL_METHOD = 'interno'
def in_tiny(order):
"""Whether the order goes to Tiny: every order but a test or a proof card
(app/proof.py), which is no sale. A Dropflow order goes in its own revenue
category (app/tiny.py, CATEGORIES)."""
if (order.get('payment') or {}).get('method') == INVOICED_METHOD:
# Held until Dropstar decides how invoiced montador orders reach Tiny
# (asked 2026-11-09).
"""Whether the order goes to Tiny: every order but an internal one, a test
or a proof card (app/proof.py), which is no sale. A Dropflow order goes in
its own revenue category (app/tiny.py, CATEGORIES)."""
if (order.get('payment') or {}).get('method') == INTERNAL_METHOD:
return False
return not is_test(order) and not order.get('parent_id')
@@ -153,9 +154,9 @@ def create_order(c, quote, payment, origin):
proof.create_child(c, order)
if is_test(order):
return order, True
# An invoiced montador order was not paid: no "pedido pago" e-mail until
# Dropstar says what the customer hears (asked 2026-11-09).
if payment.get('method') != INVOICED_METHOD:
# An invoiced or internal montador order was not paid here: no "pedido
# pago" e-mail for either (front 7a.3).
if payment.get('method') not in (INVOICED_METHOD, INTERNAL_METHOD):
mail.order_paid(c, order, PUBLIC_ORIGIN)
if not in_tiny(order):
return order, True