From TO line/sale line
This commit is contained in:
@@ -1482,6 +1482,12 @@ class Line(metaclass=PoolMeta):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def write(cls, *args):
|
def write(cls, *args):
|
||||||
|
actions = iter(args)
|
||||||
|
args = []
|
||||||
|
for records, values in zip(actions, actions):
|
||||||
|
cls._check_delivery_period_values(records, values)
|
||||||
|
args.extend((records, values))
|
||||||
|
|
||||||
# Agents:
|
# Agents:
|
||||||
# Ici on gère la variation éventuelle de la théorical quantity après création du contrat
|
# Ici on gère la variation éventuelle de la théorical quantity après création du contrat
|
||||||
# Si delta > 0 on met à jour le lot virtual qui est toujours unique pour une purchase line
|
# Si delta > 0 on met à jour le lot virtual qui est toujours unique pour une purchase line
|
||||||
@@ -1495,8 +1501,6 @@ class Line(metaclass=PoolMeta):
|
|||||||
old_values = {}
|
old_values = {}
|
||||||
|
|
||||||
for records, values in zip(args[::2], args[1::2]):
|
for records, values in zip(args[::2], args[1::2]):
|
||||||
if {'from_del', 'to_del'} & set(values):
|
|
||||||
cls._check_delivery_period_values(records, values)
|
|
||||||
if 'quantity_theorical' in values:
|
if 'quantity_theorical' in values:
|
||||||
for record in records:
|
for record in records:
|
||||||
old_values[record.id] = record.quantity_theorical
|
old_values[record.id] = record.quantity_theorical
|
||||||
|
|||||||
@@ -1604,13 +1604,17 @@ class SaleLine(metaclass=PoolMeta):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def write(cls, *args):
|
def write(cls, *args):
|
||||||
|
actions = iter(args)
|
||||||
|
args = []
|
||||||
|
for records, values in zip(actions, actions):
|
||||||
|
cls._check_delivery_period_values(records, values)
|
||||||
|
args.extend((records, values))
|
||||||
|
|
||||||
Lot = Pool().get('lot.lot')
|
Lot = Pool().get('lot.lot')
|
||||||
LotQt = Pool().get('lot.qt')
|
LotQt = Pool().get('lot.qt')
|
||||||
old_values = {}
|
old_values = {}
|
||||||
|
|
||||||
for records, values in zip(args[::2], args[1::2]):
|
for records, values in zip(args[::2], args[1::2]):
|
||||||
if {'from_del', 'to_del'} & set(values):
|
|
||||||
cls._check_delivery_period_values(records, values)
|
|
||||||
if 'quantity_theorical' in values:
|
if 'quantity_theorical' in values:
|
||||||
for record in records:
|
for record in records:
|
||||||
old_values[record.id] = record.quantity_theorical
|
old_values[record.id] = record.quantity_theorical
|
||||||
|
|||||||
@@ -595,6 +595,14 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
|||||||
SaleLine._check_delivery_period_values([valid], {
|
SaleLine._check_delivery_period_values([valid], {
|
||||||
'to_del': datetime.date(2026, 3, 31),
|
'to_del': datetime.date(2026, 3, 31),
|
||||||
})
|
})
|
||||||
|
with self.assertRaises(UserError):
|
||||||
|
PurchaseLine._check_delivery_period_values([invalid], {
|
||||||
|
'quantity': Decimal('1'),
|
||||||
|
})
|
||||||
|
with self.assertRaises(UserError):
|
||||||
|
SaleLine._check_delivery_period_values([invalid], {
|
||||||
|
'quantity': Decimal('1'),
|
||||||
|
})
|
||||||
|
|
||||||
def test_pricing_eod_uses_weighted_average_for_manual_rows(self):
|
def test_pricing_eod_uses_weighted_average_for_manual_rows(self):
|
||||||
'manual pricing eod uses the weighted average of fixed and unfixed legs'
|
'manual pricing eod uses the weighted average of fixed and unfixed legs'
|
||||||
|
|||||||
Reference in New Issue
Block a user