feat: Montar creates the invoiced order card (front 7a.2b)

The montador sends each stamp to storage, splits the list into items of
at most 20 sources and 4000 copies, packs each one with the Site's engine
and creates the order in Arte recebida: typed customer, pickup, the Site's
table price, payment 'faturado', origin dropflow for Expedição and
atendimento otherwise. Until Dropstar decides, these orders do not go to
Tiny and the customer gets no paid e-mail. Vendedor and Expedição may now
upload through the operator upload routes (can_any).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-09 15:27:04 -03:00
parent 8993eb25db
commit 2c80de0c0a
11 changed files with 312 additions and 15 deletions

View File

@@ -1,6 +1,9 @@
"""Who moves which card on the Kanban: Dropstar's flow of 2026-10-23."""
import unittest
from unittest import mock
from app import payments
from app.core import auth
from app.core.auth import CAPABILITIES, ROLES, may_move, may_reorder
from app.runtime import BACK, STATES, TRANSITIONS
@@ -60,5 +63,29 @@ class MovesTest(unittest.TestCase):
self.assertTrue(all(may_reorder('gestao', s) for s in STATES))
class CanAnyTest(unittest.TestCase):
def test_a_profile_with_any_of_the_capabilities_gets_through(self):
# The montador's stamp uploads: deliver or assemble (Fase 2, front 7).
for role, allowed in (('operador', True), ('expedicao', True), ('vendedor', True),
('designer', True), ('financeiro', False)):
with mock.patch.object(auth, 'signed_in',
return_value={'role': role, 'email': role + '@example.test'}):
route = auth.can_any('deliver', 'assemble')
if allowed:
self.assertEqual(route(None), role + '@example.test')
else:
with self.assertRaises(auth.HTTPException):
route(None)
class InvoicedOrderTest(unittest.TestCase):
def test_an_invoiced_montador_order_is_held_out_of_tiny(self):
self.assertEqual(payments.INVOICED_METHOD, 'faturado')
# It is not one of the Cotações "registrar" methods.
self.assertNotIn(payments.INVOICED_METHOD, payments.OUTSIDE_METHODS)
self.assertFalse(payments.in_tiny({'payment': {'provider': 'manual', 'method': 'faturado'}}))
self.assertTrue(payments.in_tiny({'payment': {'provider': 'manual', 'method': 'pix'}}))
if __name__ == '__main__':
unittest.main()