fix(configurator): lot pricing robust in totals + SO-create (not reliant on onchange)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-29 21:48:43 -04:00
parent dc1dacddc2
commit 2bd0672b52
2 changed files with 20 additions and 2 deletions

View File

@@ -54,3 +54,14 @@ class TestChargeTaxLot(TransactionCase):
})
line._onchange_lot_pricing()
self.assertEqual(line.unit_price, 2.0)
def test_lot_line_subtotal_uses_lot_total(self):
# Even if unit_price wasn't derived (onchange didn't fire), the
# summary subtotal uses the flat lot_total for lot-priced lines.
wiz = self._make_wizard(tax_id=self.tax13.id)
self.env['fp.direct.order.line'].create({
'wizard_id': wiz.id, 'quantity': 500, 'lot_total': 1000.0,
'is_lot_priced': True, 'unit_price': 0.0,
})
wiz.invalidate_recordset()
self.assertEqual(wiz.total_subtotal, 1000.0)