This commit is contained in:
2026-06-07 10:16:15 +02:00
parent 8e82986bd5
commit 6ac1904a0c
3 changed files with 72 additions and 2 deletions

View File

@@ -244,6 +244,44 @@ class PurchaseTradeTestCase(ModuleTestCase):
self.assertEqual(values['lines'][1]['lotqt'], 2)
self.assertEqual(values['lines'][1]['quantity'], Decimal('200'))
self.assertFalse(values['lines'][1]['cancel_plan'])
self.assertIsNone(values['default_lotqt'])
self.assertIsNone(values['default_unit'])
def test_plan_transport_defaults_single_line_for_new_rows(self):
'plan transport wizard gives new rows the current quantity line'
wizard = lot_module.LotPlanTransport()
wizard.records = [
Mock(
id=10002242,
r_lot_quantity=Decimal('1000'),
r_lot_matched=Decimal('0'),
r_lot_unit_line=Mock(id=3),
r_planned_from_location=None,
r_planned_to_location=None,
r_planned_transport_type=None,
r_planned_from_date=None,
r_planned_to_date=None,
r_planned_note=None),
]
values = wizard.default_plan(None)
self.assertEqual(values['default_lotqt'], 2242)
self.assertEqual(values['default_unit'], 3)
def test_plan_transport_line_defaults_from_context(self):
'new planning lines read their lot.qt and unit from the parent context'
context = {
'lot_plan_transport_default_lotqt': 2242,
'lot_plan_transport_default_unit': 3,
}
with patch.object(
lot_module, 'Transaction',
return_value=Mock(context=context)):
self.assertEqual(
lot_module.LotPlanTransportLine.default_lotqt(), 2242)
self.assertEqual(
lot_module.LotPlanTransportLine.default_unit(), 3)
def test_plan_transport_applies_each_planning_line(self):
'plan transport wizard applies each line independently'