This commit is contained in:
2026-06-05 07:46:48 +02:00
parent 1de1d15064
commit 574c1a67f4
2 changed files with 46 additions and 8 deletions

View File

@@ -134,6 +134,32 @@ class PurchaseTradeTestCase(ModuleTestCase):
strategy.get_mtm(line, Decimal('3')),
Decimal('225.00'))
@with_transaction()
def test_signed_strategy_mtm_follows_valuation_direction(self):
'strategy MTM follows purchase/sale valuation sign'
Valuation = Pool().get('valuation.valuation')
strategy = Mock(get_mtm=Mock(return_value=Decimal('349167.53')))
line = Mock()
self.assertEqual(
Valuation._signed_strategy_mtm(
{'type': 'pur. priced', 'amount': Decimal('-190686.15'),
'quantity': Decimal('4237.47')},
strategy, line),
Decimal('-349167.53'))
self.assertEqual(
Valuation._signed_strategy_mtm(
{'type': 'sale priced', 'amount': Decimal('349167.53'),
'quantity': Decimal('4237.47')},
strategy, line),
Decimal('349167.53'))
self.assertEqual(
Valuation._signed_strategy_mtm(
{'type': 'pur. priced', 'amount': Decimal('0'),
'quantity': Decimal('0')},
strategy, line),
Decimal('-349167.53'))
@with_transaction()
def test_purchase_line_charter_conditions_inherit_header_when_empty(self):
'purchase line uses header charter conditions when it has no line terms'