feat(configurator): totals = one tax on (subtotal + charge)

This commit is contained in:
gsinghpal
2026-05-29 21:37:00 -04:00
parent a07a5f931a
commit f8929eb686
2 changed files with 37 additions and 45 deletions

View File

@@ -28,3 +28,19 @@ class TestChargeTaxLot(TransactionCase):
self.assertEqual(ct.default_amount, 75.0)
cid, cname = self.env['fp.additional.charge.type'].name_create('Setup')
self.assertTrue(cid)
# ----- Task 3: totals -----
def _make_wizard(self, **kw):
vals = {'partner_id': self.partner.id}
vals.update(kw)
return self.env['fp.direct.order.wizard'].create(vals)
def test_tax_applies_on_subtotal_plus_charge(self):
wiz = self._make_wizard(charge_amount=100.0, tax_id=self.tax13.id)
self.env['fp.direct.order.line'].create({
'wizard_id': wiz.id, 'quantity': 1, 'unit_price': 50.0,
})
wiz.invalidate_recordset()
self.assertEqual(wiz.total_subtotal, 50.0)
self.assertAlmostEqual(wiz.total_tax, 19.5, places=2)
self.assertAlmostEqual(wiz.total_amount, 169.5, places=2)