Add insured amount

This commit is contained in:
2026-04-07 10:54:14 +02:00
parent 2109d7a3e4
commit 5179d98289
4 changed files with 61 additions and 6 deletions

View File

@@ -509,6 +509,27 @@ class PurchaseTradeTestCase(ModuleTestCase):
shipment.report_insurance_issue_place_and_date,
'GENEVA, 06-04-2026')
def test_shipment_insurance_amount_fallback_uses_lot_and_incoming_moves(self):
'insurance amount falls back to lot unit price and shipment quantities'
ShipmentIn = Pool().get('stock.shipment.in')
shipment = ShipmentIn()
purchase_currency = Mock(rec_name='USD')
purchase = Mock(currency=purchase_currency)
line = Mock(unit_price=Decimal('100'), purchase=purchase)
lot = Mock(line=line)
lot.get_current_quantity_converted = Mock(return_value=Decimal('5'))
move = Mock(quantity=Decimal('0'), unit_price=None, currency=None, lot=lot)
shipment.incoming_moves = [move]
shipment.fees = []
self.assertEqual(
shipment.report_insurance_incoming_amount, 'USD 500.00')
self.assertEqual(
shipment.report_insurance_amount_insured, 'USD 550.00')
self.assertEqual(
shipment.report_insurance_amount, 'USD 550.00')
def test_sale_report_multi_line_helpers_aggregate_all_lines(self):
'sale report helpers aggregate quantity, price lines and shipment periods'
Sale = Pool().get('sale.sale')