Demurrage

This commit is contained in:
2026-06-03 13:50:28 +02:00
parent c096b39259
commit 0094bd6974
2 changed files with 77 additions and 5 deletions

View File

@@ -214,6 +214,33 @@ class PurchaseTradeTestCase(ModuleTestCase):
sof._applied_compensation_amount(), Decimal('-12000.00'))
self.assertEqual(sof.compensation_type, 'demurrage')
@with_transaction()
def test_sof_laytime_start_reads_text_clause_turn_time(self):
'sof laytime start reads NOR plus hours from the condition text'
Sof = Pool().get('sof.statement')
sof = Sof()
sof.applied_condition = Mock(
turn_time=None,
laytime_start='NOR + 6 hours')
sof.notice_of_readiness_time = datetime.datetime(2026, 6, 1, 2, 0)
self.assertEqual(
sof._applied_laytime_start(),
datetime.datetime(2026, 6, 1, 8, 0))
@with_transaction()
def test_sof_laytime_end_reads_hoses_disconnected_clause(self):
'sof laytime end can use hoses disconnected from the condition text'
Sof = Pool().get('sof.statement')
sof = Sof()
sof.applied_condition = Mock(laytime_end='Hoses disconnected')
sof.end_pumping = datetime.datetime(2026, 6, 1, 12, 0)
sof.hoses_disconnected = datetime.datetime(2026, 6, 1, 13, 0)
self.assertEqual(
sof._applied_laytime_end(),
datetime.datetime(2026, 6, 1, 13, 0))
@with_transaction()
def test_sof_header_date_time_values_sync_to_datetime(self):
'sof header date and time fields build the technical datetime value'