From cdfc117220684fd31501f300849b9d4836b21b64 Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Thu, 14 May 2026 16:54:32 +0200 Subject: [PATCH] Bug Create contract --- modules/purchase_trade/service.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/purchase_trade/service.py b/modules/purchase_trade/service.py index c38a5b4..3115324 100644 --- a/modules/purchase_trade/service.py +++ b/modules/purchase_trade/service.py @@ -331,8 +331,19 @@ class ContractFactory: lqh.gross_quantity = round(lot.lot_quantity, 5) lot.lot_hist = [lqh] - with Transaction().set_context( - _purchase_trade_skip_quantity_consistency=True): + logger.info( + "CREATE_CONTRACT_LOT_BEFORE_SAVE type=%s line=%s qty=%s " + "source_lot=%s source_lqt=%s shipment=%s skip_before=%s", + type_, + getattr(line, 'id', None), + getattr(lot, 'lot_quantity', None), + getattr(source.get('lot'), 'id', None), + getattr(source.get('lqt'), 'id', None), + source.get('shipment_origin'), + Transaction().context.get( + '_purchase_trade_skip_quantity_consistency')) + + with Lot.skip_quantity_consistency(): lot.save() logger.info( "CREATE_CONTRACT_LOT_SAVED type=%s line=%s lot=%s qty=%s "