Bug check qt

This commit is contained in:
2026-05-14 13:33:14 +02:00
parent e683ce7e62
commit 82a30f246d
2 changed files with 16 additions and 28 deletions

View File

@@ -1741,14 +1741,6 @@ class Line(metaclass=PoolMeta):
if free_quantity < 0:
raise UserError("Please unlink or unmatch lot")
current_quantity = round(
Decimal(vlot.get_current_quantity_converted() or 0), 5)
if current_quantity != target_quantity:
vlot.set_current_quantity(target_quantity, target_quantity, 1)
with Transaction().set_context(
_purchase_trade_skip_quantity_consistency=True):
Lot.save([vlot])
if free_lqts:
lqt = free_lqts[0]
logger.info(
@@ -1757,9 +1749,7 @@ class Line(metaclass=PoolMeta):
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])
LotQt.save([lqt])
logger.info(
"PURCHASE_QTY_SYNC_FREE_AFTER lqt=%s quantity=%s",
getattr(lqt, 'id', None),
@@ -1770,9 +1760,13 @@ class Line(metaclass=PoolMeta):
lqt.lot_s = None
lqt.lot_quantity = free_quantity
lqt.lot_unit = line.unit
with Transaction().set_context(
_purchase_trade_skip_quantity_consistency=True):
LotQt.save([lqt])
LotQt.save([lqt])
current_quantity = round(
Decimal(vlot.get_current_quantity_converted() or 0), 5)
if current_quantity != target_quantity:
vlot.set_current_quantity(target_quantity, target_quantity, 1)
Lot.save([vlot])
@classmethod
def copy(cls, lines, default=None):

View File

@@ -1855,14 +1855,6 @@ class SaleLine(metaclass=PoolMeta):
if free_quantity < 0:
raise UserError("Please unlink or unmatch lot")
current_quantity = round(
Decimal(vlot.get_current_quantity_converted() or 0), 5)
if current_quantity != target_quantity:
vlot.set_current_quantity(target_quantity, target_quantity, 1)
with Transaction().set_context(
_purchase_trade_skip_quantity_consistency=True):
Lot.save([vlot])
if free_lqts:
lqt = free_lqts[0]
logger.info(
@@ -1871,9 +1863,7 @@ class SaleLine(metaclass=PoolMeta):
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])
LotQt.save([lqt])
logger.info(
"SALE_QTY_SYNC_FREE_AFTER lqt=%s quantity=%s",
getattr(lqt, 'id', None),
@@ -1884,9 +1874,13 @@ class SaleLine(metaclass=PoolMeta):
lqt.lot_s = vlot.id
lqt.lot_quantity = free_quantity
lqt.lot_unit = line.unit
with Transaction().set_context(
_purchase_trade_skip_quantity_consistency=True):
LotQt.save([lqt])
LotQt.save([lqt])
current_quantity = round(
Decimal(vlot.get_current_quantity_converted() or 0), 5)
if current_quantity != target_quantity:
vlot.set_current_quantity(target_quantity, target_quantity, 1)
Lot.save([vlot])
@classmethod
def delete(cls, lines):