Get amount

This commit is contained in:
2026-07-21 23:35:39 +02:00
parent ab80f8d909
commit 493dd54606
3 changed files with 32 additions and 13 deletions

View File

@@ -2700,6 +2700,26 @@ class PurchaseTradeTestCase(ModuleTestCase):
self.assertEqual(fee.quantity, Decimal('40.00000'))
save.assert_called_once_with([fee])
def test_shipment_per_quantity_fee_amount_uses_fee_lots_quantity(self):
'shipment per quantity fee amount ignores unrelated shipment moves'
Fee = Pool().get('fee.fee')
fee = Fee()
fee.mode = 'perqt'
fee.price = Decimal('3.14')
fee.quantity = Decimal('3000')
fee.add_padding = False
fee.shipment_in = Mock(id=7)
with patch.object(
fee, '_get_effective_fee_lots_quantity',
return_value=Decimal('3000')) as lots_quantity, patch(
'trytond.modules.purchase_trade.fee.Pool') as PoolMock:
amount = fee.get_amount()
self.assertEqual(amount, Decimal('9420.00'))
lots_quantity.assert_called_once_with()
PoolMock.assert_not_called()
def test_shipment_fee_lot_domain_keeps_open_virtual_lots(self):
'shipment fee lot domain keeps virtual lots after partial physical add'
Fee = Pool().get('fee.fee')