This commit is contained in:
2026-01-27 22:50:34 +01:00
parent fabc380784
commit f6fe3fb2bd

View File

@@ -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']) 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 factor = weight_total / wr.net_landed_kg if wr.net_landed_kg else 1
for lot in sale_line.lots: for lot in sale_line.lots:
wr_payload = { if lot.lot_type == 'physic':
"chunk_key": lot.lot_chunk_key, wr_payload = {
"gross_weight": round(lot.lot_gross_quantity / factor,5), "chunk_key": lot.lot_chunk_key,
"net_weight": round(lot.lot_quantity / factor,5), "gross_weight": round(lot.lot_gross_quantity / factor,5),
"tare_total": round(wr.tare_kg * (lot.lot_quantity / weight_total),5) , "net_weight": round(lot.lot_quantity / factor,5),
"bags": int(wr.bales * (lot.lot_quantity / weight_total)), "tare_total": round(wr.tare_kg * (lot.lot_quantity / weight_total),5) ,
"surveyor_code": 231, "bags": int(wr.bales * (lot.lot_quantity / weight_total)),
"place_key": 0, "surveyor_code": 231,
"report_date": 20260127 "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" data = doc.create_weight_report(wr_payload)
doc.notes = (doc.notes or "") + f"WR key: {data.get('weight_report_key')}\n" 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:[] # if cls.rule_set.ocr_required:[]
# cls.run_ocr([doc]) # cls.run_ocr([doc])