Bug check qt

This commit is contained in:
2026-05-14 12:32:31 +02:00
parent 3c788d4764
commit e683ce7e62
2 changed files with 26 additions and 10 deletions

View File

@@ -1751,11 +1751,19 @@ class Line(metaclass=PoolMeta):
if free_lqts:
lqt = free_lqts[0]
if Decimal(lqt.lot_quantity or 0) != free_quantity:
lqt.lot_quantity = free_quantity
with Transaction().set_context(
_purchase_trade_skip_quantity_consistency=True):
LotQt.save([lqt])
logger.info(
"PURCHASE_QTY_SYNC_FREE_BEFORE lqt=%s quantity=%s new=%s",
getattr(lqt, 'id', None),
getattr(lqt, 'lot_quantity', None),
free_quantity)
lqt.lot_quantity = free_quantity
with Transaction().set_context(
_purchase_trade_skip_quantity_consistency=True):
LotQt.save([lqt])
logger.info(
"PURCHASE_QTY_SYNC_FREE_AFTER lqt=%s quantity=%s",
getattr(lqt, 'id', None),
getattr(LotQt(getattr(lqt, 'id')), 'lot_quantity', None))
elif free_quantity > 0:
lqt = LotQt()
lqt.lot_p = vlot.id

View File

@@ -1865,11 +1865,19 @@ class SaleLine(metaclass=PoolMeta):
if free_lqts:
lqt = free_lqts[0]
if Decimal(lqt.lot_quantity or 0) != free_quantity:
lqt.lot_quantity = free_quantity
with Transaction().set_context(
_purchase_trade_skip_quantity_consistency=True):
LotQt.save([lqt])
logger.info(
"SALE_QTY_SYNC_FREE_BEFORE lqt=%s quantity=%s new=%s",
getattr(lqt, 'id', None),
getattr(lqt, 'lot_quantity', None),
free_quantity)
lqt.lot_quantity = free_quantity
with Transaction().set_context(
_purchase_trade_skip_quantity_consistency=True):
LotQt.save([lqt])
logger.info(
"SALE_QTY_SYNC_FREE_AFTER lqt=%s quantity=%s",
getattr(lqt, 'id', None),
getattr(LotQt(getattr(lqt, 'id')), 'lot_quantity', None))
elif free_quantity > 0:
lqt = LotQt()
lqt.lot_p = None