From 878588d5676df57c41053ec1fc94404a33879e60 Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Wed, 11 Feb 2026 08:20:23 +0100 Subject: [PATCH] 11.02.26 --- modules/automation/automation.py | 4 ++-- modules/purchase_trade/weight_report.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/automation/automation.py b/modules/automation/automation.py index 3fe7000..6458e97 100644 --- a/modules/automation/automation.py +++ b/modules/automation/automation.py @@ -249,8 +249,8 @@ class AutomationDocument(ModelSQL, ModelView, Workflow): "bags": int(lot.lot_qt), "surveyor_code": sh[0].controller.get_alf(), "place_key": sh[0].to_location.get_places(), - "report_date": wr.report_date.isoformat(), - "weight_date": wr.weight_date.isoformat(), + "report_date": wr.report_date.isoformat() if wr.report_date else None, + "weight_date": wr.weight_date.isoformat() if wr.weight_date else None, "agent": sh[0].agent.get_alf() } logger.info("PAYLOAD:%s",wr_payload) diff --git a/modules/purchase_trade/weight_report.py b/modules/purchase_trade/weight_report.py index 623fe66..c1fe68f 100644 --- a/modules/purchase_trade/weight_report.py +++ b/modules/purchase_trade/weight_report.py @@ -105,7 +105,6 @@ class WeightReport(ModelSQL, ModelView): return None report['report_date'] = parse_date(report_data.get('date', '')) - report['weight_date'] = parse_date(report_data.get('weight_date', '')) logger.info("RETRUN_DATE:%s",report['weight_date']) # 3. Contract Information contract_data = json_data.get('contract', {}) @@ -193,6 +192,7 @@ class WeightReport(ModelSQL, ModelView): gain_loss_percent = Decimal(str(weights_data.get('gain_loss_percent', 0) or 0)) # Arrondir à 2 décimales + report['weight_date'] = parse_date(weights_data.get('weight_date', '')) report['gross_landed_kg'] = gross.quantize(Decimal('0.01'), rounding=ROUND_HALF_UP) report['tare_kg'] = tare.quantize(Decimal('0.01'), rounding=ROUND_HALF_UP) report['net_landed_kg'] = net.quantize(Decimal('0.01'), rounding=ROUND_HALF_UP)