From f6fe3fb2bd6de726b8b20d4b79646f5a382ca66a Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Tue, 27 Jan 2026 22:50:34 +0100 Subject: [PATCH] 27.01.26 --- modules/automation/automation.py | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/modules/automation/automation.py b/modules/automation/automation.py index 0be1f3c..b3ae75c 100644 --- a/modules/automation/automation.py +++ b/modules/automation/automation.py @@ -387,19 +387,20 @@ class AutomationDocument(ModelSQL, ModelView, Workflow): weight_total = sum([l.lot_quantity for l in sale_line.lots if l.lot_type == 'physic']) factor = weight_total / wr.net_landed_kg if wr.net_landed_kg else 1 for lot in sale_line.lots: - wr_payload = { - "chunk_key": lot.lot_chunk_key, - "gross_weight": round(lot.lot_gross_quantity / factor,5), - "net_weight": round(lot.lot_quantity / factor,5), - "tare_total": round(wr.tare_kg * (lot.lot_quantity / weight_total),5) , - "bags": int(wr.bales * (lot.lot_quantity / weight_total)), - "surveyor_code": 231, - "place_key": 0, - "report_date": 20260127 - } - data = doc.create_weight_report(wr_payload) - doc.notes = (doc.notes or "") + f"WR created in Fintrade: {data.get('success')}\n" - doc.notes = (doc.notes or "") + f"WR key: {data.get('weight_report_key')}\n" + if lot.lot_type == 'physic': + wr_payload = { + "chunk_key": lot.lot_chunk_key, + "gross_weight": round(lot.lot_gross_quantity / factor,5), + "net_weight": round(lot.lot_quantity / factor,5), + "tare_total": round(wr.tare_kg * (lot.lot_quantity / weight_total),5) , + "bags": int(wr.bales * (lot.lot_quantity / weight_total)), + "surveyor_code": 231, + "place_key": 0, + "report_date": 20260127 + } + data = doc.create_weight_report(wr_payload) + doc.notes = (doc.notes or "") + f"WR created in Fintrade: {data.get('success')}\n" + doc.notes = (doc.notes or "") + f"WR key: {data.get('weight_report_key')}\n" # if cls.rule_set.ocr_required:[] # cls.run_ocr([doc])