feat: places per machine, drops on Imprimindo go to your machine, a Venda carries its seller to Tiny (DTF-WEB-V)
All checks were successful
Build and deploy / Validate source (push) Successful in 10s
Build and deploy / Integration suite on a real stack (push) Successful in 7m38s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m19s

Marcus, 2026-11-17:
- Each machine has its own places (machines.places, 1 to 6, three to
  start): orders at once in Imprimindo and files at once in its hot
  folder. Admin sets it in the machine dialog; Admin and Gestão in the
  machine sheet's Dados da máquina. A third order shows as "Na vez".
- Whoever is signed in on a machine drops a card anywhere in Imprimindo
  and it goes to that machine; without one, the lane under the pointer.
- Each Kanban user may name their Tiny seller (Usuários, read from
  Tiny's own list); a montador Venda reaches Tiny with the seller of who
  assembled it. Every other order still sends no seller.
- A folder download that never reached storage (a network drop) waits
  for the next pass as a warning and is reported only if it keeps
  failing (Sentry DTF-WEB-V).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-17 14:18:19 -03:00
parent c61ac27ca4
commit aaa6090642
19 changed files with 244 additions and 63 deletions

View File

@@ -149,7 +149,7 @@ PICKUP_CARRIER = 761565838
# Dropstar's answers: the financial category "DTF SITE" (RECEITAS, id sent on
# 2026-10-26; it goes in pagamento.categoria, and replaced the store's
# "DUPLICADO DROP", 965775137), no seller (Tiny sets it from the contact,
# 2026-10-23), and the marcador SITE DTF, added after the order is created:
# 2026-10-23; a montador Venda carries who assembled it, 2026-11-17), and the marcador SITE DTF, added after the order is created:
# POST /pedidos does not take marcadores. Capitals, no accent, no extra
# space: the string Kondado reads for Power BI.
CATEGORY = 986932924
@@ -460,6 +460,24 @@ def search_forms(document):
return list(dict.fromkeys((punctuated(d), d)))
def list_sellers(orders, pages=10):
"""Tiny's sellers (vendedores) as [{id, name}], for the Kanban user a
Venda's seller comes from (Marcus, 2026-11-17). v3 names the seller on
the entry or on its contact; both are read."""
sellers = []
for page in range(pages):
found = orders.request('GET', '/vendedores', params={'limit': 100, 'offset': page * 100})
items = found if isinstance(found, list) else (found.get('itens') or [])
for entry in items:
contact = entry.get('contato') or {}
name = entry.get('nome') or contact.get('nome') or contact.get('fantasia') or ''
if entry.get('id'):
sellers.append({'id': entry['id'], 'name': name or f"Vendedor {entry['id']}"})
if len(items) < 100:
break
return sorted(sellers, key=lambda s: s['name'].lower())
def search_contacts(orders, query, limit=10):
"""Up to `limit` contacts matching what was typed (the montador's typeahead,
front 7a.3): by CPF/CNPJ when it is only digits and punctuation, else by
@@ -591,6 +609,11 @@ def order_payload(payload, contact_id, today=None, product_id=None, shipping=Non
'valorFrete': money(freight['total_cents']),
'observacoes': f"Pedido DTF #{payload['number']}" + (' · retirada em Franca' if pickup else ''),
'observacoesInternas': internal_note(payload)}
# No seller, so Tiny's channel sets it (Dropstar, 2026-10-23), except a
# montador Venda, whose seller is who assembled it (Marcus, 2026-11-17).
seller = (order.get('seller') or {}).get('id')
if seller:
pedido['vendedor'] = {'id': int(seller)}
coupon = order.get('coupon') or {}
if coupon:
# Tiny's v3 order has the order-level discount next to valorFrete.