CreateContract

This commit is contained in:
2026-05-20 14:04:22 +02:00
parent 072960307a
commit 1f3616858a
2 changed files with 6 additions and 4 deletions

View File

@@ -240,10 +240,10 @@ class ContractFactory:
return
line.del_period = c.del_period
line.from_del = (
c.from_del
getattr(c, 'from_del', None)
or getattr(getattr(c, 'del_period', None), 'beg_date', None))
line.to_del = (
c.to_del
getattr(c, 'to_del', None)
or getattr(getattr(c, 'del_period', None), 'end_date', None))
@staticmethod

View File

@@ -2848,8 +2848,10 @@ class PurchaseTradeTestCase(ModuleTestCase):
def test_contract_factory_delivery_dates_fallback_to_period(self):
'hidden delivery dates are still derived from delivery period'
period = Mock(beg_date='2026-05-01', end_date='2026-05-31')
contract_detail = Mock(
del_period=period, from_del=None, to_del=None)
class ContractDetailMock:
del_period = period
contract_detail = ContractDetailMock()
line = Mock()
ContractFactory._apply_delivery(line, contract_detail, {})