Bug lot.qt

This commit is contained in:
2026-07-14 12:02:07 +02:00
parent 07ee8b4f99
commit cf4bd94d03
3 changed files with 8 additions and 296 deletions

View File

@@ -6764,83 +6764,9 @@ description</t></is></c>
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_linkage_report_does_not_extend_lotqt_model(self):
'linkage report must not alter the lot.qt ORM model'
self.assertFalse(hasattr(stock_module, 'LotQt'))
def test_lot_report_linkage_rejects_non_physical_lines(self):
'lot.report linkage report is only available for physical lines'