Linkage report

This commit is contained in:
2026-08-05 18:09:23 +02:00
parent 2bcbf169cf
commit 3bb2811e76
4 changed files with 118 additions and 20 deletions

View File

@@ -7531,9 +7531,21 @@ description</t></is></c>
lot = SimpleNamespace(
id=101,
lot_type='physic',
lot_quantity=Decimal('40'),
lot_unit_line=unit,
line=purchase_line,
sale_line=sale_line)
shipment.incoming_moves = [SimpleNamespace(lot=lot)]
other_lot = SimpleNamespace(
id=102,
lot_type='physic',
lot_quantity=Decimal('20'),
lot_unit_line=unit,
line=purchase_line,
sale_line=sale_line)
shipment.incoming_moves = [
SimpleNamespace(lot=lot),
SimpleNamespace(lot=other_lot),
]
shipment.vessel = SimpleNamespace(vessel_name='MV ATLANTIC')
self.assertEqual(
@@ -7545,8 +7557,8 @@ description</t></is></c>
shipment.report_linkage_bl_date, 'Thursday, April 30, 2026')
self.assertIn('Purchases', shipment.report_linkage_summary_groups)
self.assertIn('Sales', shipment.report_linkage_summary_groups)
self.assertIn('-8,000.000', shipment.report_linkage_summary_estimated)
self.assertIn('10,000.000', shipment.report_linkage_summary_estimated)
self.assertIn('-4,800.000', shipment.report_linkage_summary_estimated)
self.assertIn('6,000.000', shipment.report_linkage_summary_estimated)
summary_rows = shipment._get_report_linkage_summary_rows()
freight_rows = [
row for row in summary_rows
@@ -7555,7 +7567,11 @@ description</t></is></c>
self.assertEqual(freight_rows[0][2], Decimal('-25'))
self.assertIn('P-10', shipment.report_linkage_movement_references)
self.assertIn('S-20', shipment.report_linkage_movement_references)
self.assertIn('100 MT', shipment.report_linkage_movement_quantities)
self.assertIn('60 MT', shipment.report_linkage_movement_quantities)
detail_rows = shipment._get_report_linkage_detail_rows()
deal_rows = [row for row in detail_rows if row[8] == 'line']
self.assertTrue(deal_rows)
self.assertTrue(all(row[5] == '60' for row in deal_rows))
self.assertIn('80.000 USD/MT', shipment.report_linkage_pricing_input_prices)
self.assertIn('100.000 USD/MT', shipment.report_linkage_pricing_input_prices)