Demurrage

This commit is contained in:
2026-07-09 17:13:41 +02:00
parent 858b7258d9
commit 9cf1bc3604
3 changed files with 39 additions and 12 deletions

View File

@@ -1457,6 +1457,35 @@ class PurchaseTradeTestCase(ModuleTestCase):
sof._applied_compensation_amount(), Decimal('-12000.00'))
self.assertEqual(sof.compensation_type, 'demurrage')
@with_transaction()
def test_sof_available_conditions_include_shipment_contracts(self):
'sof applied condition choices include owner, purchase and sale terms'
Sof = Pool().get('sof.statement')
sof = Sof()
sof.charter_party = None
sof.shipment = Mock(
get_owner_charter_conditions=Mock(return_value=[1]),
get_purchase_charter_conditions=Mock(return_value=[2]),
get_sale_charter_conditions=Mock(return_value=[3]))
self.assertEqual(sof.get_applied_conditions(), [1, 2, 3])
@with_transaction()
def test_sof_default_applied_condition_can_use_purchase_terms(self):
'sof default applied condition can come from purchase without charter'
Sof = Pool().get('sof.statement')
sof = Sof()
sof.charter_party = None
sof.shipment = Mock(
charter_party=None,
get_owner_charter_conditions=Mock(return_value=[]),
get_purchase_charter_conditions=Mock(return_value=[12]),
get_sale_charter_conditions=Mock(return_value=[]))
sof.on_change_shipment()
self.assertEqual(sof.applied_condition, 12)
@with_transaction()
def test_sof_laytime_start_reads_structured_condition_rule(self):
'sof laytime start reads the structured event and offset'