feat: approving the final file is the Kanban's next step, at the top of the order
All checks were successful
Build and deploy / Validate source (push) Successful in 1m11s
Build and deploy / Integration suite on a real stack (push) Successful in 3m7s
Build and deploy / Secret scan and release gate (push) Successful in 10s
Build and deploy / Publish images (push) Successful in 1m24s
All checks were successful
Build and deploy / Validate source (push) Successful in 1m11s
Build and deploy / Integration suite on a real stack (push) Successful in 3m7s
Build and deploy / Secret scan and release gate (push) Successful in 10s
Build and deploy / Publish images (push) Successful in 1m24s
An order in Arte tratada without an approved final showed "Mover para Fila de impressão" as its main button, which the server refused, while the approval sat folded at the bottom of the panel. Now the top of the panel says what comes next: approve the final, with the file that would be printed and a link to download it. A customer's correction or the generated PDF is approved with one click; otherwise the upload form opens in place. Once approved, the main button becomes the move to the queue. A customer's correction can be approved as the final itself, without downloading and sending it back. The board carries each order's approved items and corrections, so cards say "Falta aprovar o final", "Correção recebida" or "Final aprovado", and the item card shows the correction instead of the stale reason the generated file could not be made. Going back a stage is a small link, and cancelling or deleting a test order moved into a "⋯" menu. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,21 @@ def generated_owner(c, order, ref, kind):
|
||||
# A large sheet's print file is its original, owned by the customer.
|
||||
return c.execute('SELECT owner FROM dtf_local.uploads WHERE id=%s', (ref.upload_id,)).fetchone()['owner']
|
||||
|
||||
|
||||
def correction_owner(c, order, ref, kind):
|
||||
"""The owner of a customer correction approved as it is, or None if it is not one.
|
||||
|
||||
A corrected file is often ready to print: the operator approves it as the
|
||||
final of the item it corrects, without downloading and sending it back.
|
||||
"""
|
||||
if kind != 'final':
|
||||
return None
|
||||
row = c.execute('''SELECT u.owner FROM dtf_local.order_files f JOIN dtf_local.uploads u ON u.id=f.upload_id
|
||||
WHERE f.order_id=%s AND f.upload_id=%s AND f.kind='correction' AND f.active AND f.item_index=%s''',
|
||||
(order['id'], ref.upload_id, ref.item_index)).fetchone()
|
||||
return row and row['owner']
|
||||
|
||||
|
||||
def submit_files(c, order, body, identity, kind, actor):
|
||||
if order['version'] != body.version:
|
||||
raise HTTPException(409, 'Order changed. Refresh before submitting files.')
|
||||
@@ -52,11 +67,14 @@ def submit_files(c, order, body, identity, kind, actor):
|
||||
if expiry <= datetime.now(timezone.utc):
|
||||
raise HTTPException(410, 'Order artwork retention has expired')
|
||||
for ref in body.files:
|
||||
upload = upload_row(c, ref.upload_id, generated_owner(c, order, ref, kind) or identity, lock=True)
|
||||
corrected = correction_owner(c, order, ref, kind)
|
||||
upload = upload_row(c, ref.upload_id, corrected or generated_owner(c, order, ref, kind) or identity, lock=True)
|
||||
if not upload['complete']:
|
||||
raise HTTPException(409, 'Complete all uploads first')
|
||||
require_clean(upload)
|
||||
if c.execute('SELECT id FROM dtf_local.order_files WHERE upload_id=%s', (ref.upload_id,)).fetchone():
|
||||
# Attached once, except a correction approved as its own final.
|
||||
if c.execute('SELECT id FROM dtf_local.order_files WHERE upload_id=%s'+(" AND kind<>'correction'" if corrected else ''),
|
||||
(ref.upload_id,)).fetchone():
|
||||
raise HTTPException(409, 'File is already attached. Upload a new revision.')
|
||||
# A new customer correction supersedes every final prepared from earlier
|
||||
# artwork, including finals uploaded while this order was in correction.
|
||||
|
||||
Reference in New Issue
Block a user