bug check qt
This commit is contained in:
@@ -1178,6 +1178,13 @@ class Line(metaclass=PoolMeta):
|
||||
values['quantity'] = Decimal(str(quantity)).quantize(
|
||||
Decimal("0.00001"))
|
||||
|
||||
@classmethod
|
||||
def _fresh_lines_for_quantity_consistency(cls, lines):
|
||||
try:
|
||||
return [cls(line.id) for line in lines if getattr(line, 'id', None)]
|
||||
except Exception:
|
||||
return lines
|
||||
|
||||
@classmethod
|
||||
def default_pricing_rule(cls):
|
||||
try:
|
||||
@@ -1680,7 +1687,8 @@ class Line(metaclass=PoolMeta):
|
||||
fee.sync_quantity_from_lots()
|
||||
fee.adjust_purchase_values()
|
||||
|
||||
Pool().get('lot.lot').assert_lines_quantity_consistency(lines)
|
||||
Pool().get('lot.lot').assert_lines_quantity_consistency(
|
||||
cls._fresh_lines_for_quantity_consistency(lines))
|
||||
|
||||
@classmethod
|
||||
def _sync_open_lot_quantity(cls, line, vlot, target_quantity):
|
||||
|
||||
@@ -1137,6 +1137,13 @@ class SaleLine(metaclass=PoolMeta):
|
||||
values['quantity'] = Decimal(str(quantity)).quantize(
|
||||
Decimal("0.00001"))
|
||||
|
||||
@classmethod
|
||||
def _fresh_lines_for_quantity_consistency(cls, lines):
|
||||
try:
|
||||
return [cls(line.id) for line in lines if getattr(line, 'id', None)]
|
||||
except Exception:
|
||||
return lines
|
||||
|
||||
def get_invoice_line(self, lots=None, action=None):
|
||||
lines = super().get_invoice_line(lots, action)
|
||||
if action != 'prov' or not lots:
|
||||
@@ -1795,7 +1802,8 @@ class SaleLine(metaclass=PoolMeta):
|
||||
fee.sync_quantity_from_lots()
|
||||
fee.adjust_purchase_values()
|
||||
|
||||
Pool().get('lot.lot').assert_lines_quantity_consistency(lines)
|
||||
Pool().get('lot.lot').assert_lines_quantity_consistency(
|
||||
cls._fresh_lines_for_quantity_consistency(lines))
|
||||
|
||||
@classmethod
|
||||
def _sync_open_lot_quantity(cls, line, vlot, target_quantity):
|
||||
|
||||
Reference in New Issue
Block a user