Linkage report
This commit is contained in:
@@ -6506,6 +6506,84 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
self.assertIn('80.000 USD/MT', shipment.report_linkage_pricing_input_prices)
|
||||
self.assertIn('100.000 USD/MT', shipment.report_linkage_pricing_input_prices)
|
||||
|
||||
def test_lotqt_linkage_helpers_use_single_matching(self):
|
||||
'lot.qt linkage helpers expose only the selected matching'
|
||||
LotQt = Pool().get('lot.qt')
|
||||
lotqt = LotQt()
|
||||
|
||||
currency = SimpleNamespace(code='USD')
|
||||
unit = SimpleNamespace(symbol='MT')
|
||||
product = SimpleNamespace(
|
||||
rec_name='Sulphuric Acid',
|
||||
name='Sulphuric Acid',
|
||||
code='H2SO4')
|
||||
purchase = SimpleNamespace(
|
||||
id=1,
|
||||
number='P-10',
|
||||
reference='26.0001',
|
||||
currency=currency,
|
||||
party=SimpleNamespace(rec_name='SUPPLIER SA'),
|
||||
to_location=SimpleNamespace(rec_name='Odda'),
|
||||
incoterm=SimpleNamespace(code='FOB'),
|
||||
operator=SimpleNamespace(rec_name='Operator A'))
|
||||
sale = SimpleNamespace(
|
||||
id=2,
|
||||
number='S-20',
|
||||
reference='26.0001',
|
||||
currency=currency,
|
||||
party=SimpleNamespace(rec_name='CLIENT SA'),
|
||||
to_location=SimpleNamespace(rec_name='Mejillones'),
|
||||
incoterm=SimpleNamespace(code='CFR'))
|
||||
period = SimpleNamespace(rec_name='Chile FY26')
|
||||
purchase_line = SimpleNamespace(
|
||||
id=11,
|
||||
product=product,
|
||||
purchase=purchase,
|
||||
quantity_theorical=Decimal('100'),
|
||||
quantity=Decimal('100'),
|
||||
unit_price=Decimal('80'),
|
||||
unit=unit,
|
||||
price_type='fixed',
|
||||
del_period=period,
|
||||
period_at='laycan',
|
||||
from_del=datetime.date(2026, 4, 30),
|
||||
to_del=datetime.date(2026, 5, 8),
|
||||
fees=[],
|
||||
mtm=[])
|
||||
sale_line = SimpleNamespace(
|
||||
id=12,
|
||||
product=product,
|
||||
sale=sale,
|
||||
quantity_theorical=Decimal('100'),
|
||||
quantity=Decimal('100'),
|
||||
unit_price=Decimal('100'),
|
||||
unit=unit,
|
||||
price_type='fixed',
|
||||
del_period=period,
|
||||
period_at='laycan',
|
||||
from_del=datetime.date(2026, 4, 30),
|
||||
to_del=datetime.date(2026, 4, 30),
|
||||
fees=[],
|
||||
mtm=[])
|
||||
lotqt.lot_p = SimpleNamespace(id=101, line=purchase_line)
|
||||
lotqt.lot_s = SimpleNamespace(id=102, sale_line=sale_line)
|
||||
lotqt.lot_shipment_in = SimpleNamespace(
|
||||
bl_date=datetime.date(2026, 4, 30),
|
||||
fees=[])
|
||||
|
||||
self.assertEqual(
|
||||
lotqt.report_linkage_title, 'Linkage P-10/S-20 26.0001')
|
||||
self.assertEqual(lotqt.report_linkage_desk, 'Sulphuric Acid')
|
||||
self.assertEqual(lotqt.report_linkage_book, 'H2SO4 Chile FY26')
|
||||
self.assertEqual(
|
||||
lotqt.report_linkage_bl_date, 'Thursday, April 30, 2026')
|
||||
self.assertIn('Purchases', lotqt.report_linkage_summary_groups)
|
||||
self.assertIn('Sales', lotqt.report_linkage_summary_groups)
|
||||
self.assertIn('P-10', lotqt.report_linkage_movement_references)
|
||||
self.assertIn('S-20', lotqt.report_linkage_movement_references)
|
||||
self.assertIn('80.000 USD/MT', lotqt.report_linkage_pricing_input_prices)
|
||||
self.assertIn('100.000 USD/MT', lotqt.report_linkage_pricing_input_prices)
|
||||
|
||||
def test_shipment_insurance_contact_surveyor_prefers_shipment_surveyor(self):
|
||||
'insurance contact surveyor property uses shipment surveyor first'
|
||||
ShipmentIn = Pool().get('stock.shipment.in')
|
||||
|
||||
Reference in New Issue
Block a user