main #7

Merged
admin merged 620 commits from main into dev 2026-03-29 13:03:25 +00:00
Showing only changes of commit f6fe3fb2bd - Show all commits

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'])
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])