From 7633f963066c4962a5d722b7e755e8468b4c2b54 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 17 Oct 2018 11:17:16 +0200 Subject: [FIX] sale_coupon: promotion program with fixed amount Steps to reproduce the bug: - Create a promotion program P with a fixed amount discount - Set a customer tax T on the discount product generated for P - Create a SO with one line - Apply the promotion program by clicking on "Update promotions" Bug: The SO line with the discount product is generated but the tax T was missing. opw:1888484 --- tests/test_program_numbers.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/test_program_numbers.py') diff --git a/tests/test_program_numbers.py b/tests/test_program_numbers.py index 01da22c1de4..8284cd1dad4 100644 --- a/tests/test_program_numbers.py +++ b/tests/test_program_numbers.py @@ -464,6 +464,12 @@ class TestSaleCouponProgramNumbers(TestSaleCouponCommon): 'discount_type': 'fixed_amount', 'discount_fixed_amount': 249.0, }) + self.tax_0pc_excl = self.env['account.tax'].create({ + 'name': "0% Tax excl", + 'amount_type': 'percent', + 'amount': 0, + }) + fixed_amount_program.discount_line_product_id.write({'taxes_id': [(4, self.tax_0pc_excl.id, False)]}) sol1 = self.env['sale.order.line'].create({ 'product_id': self.computerCase.id, 'name': 'Computer Case', @@ -477,6 +483,9 @@ class TestSaleCouponProgramNumbers(TestSaleCouponCommon): order.recompute_coupon_lines() self.assertEqual(order.amount_total, 176, "Fixed amount discount should be totally deduced") self.assertEqual(len(order.order_line.ids), 2, "Number of lines should be unchanged as we just recompute the reward line") + sol2 = order.order_line.filtered(lambda l: l.id != sol1.id) + self.assertEqual(len(sol2.tax_id.ids), 1, "One tax should be present on the reward line") + self.assertEqual(sol2.tax_id.id, self.tax_0pc_excl.id, "The tax should be 0% Tax excl") fixed_amount_program.write({'active': False}) # Check archived product will remove discount lines on recompute order.recompute_coupon_lines() self.assertEqual(len(order.order_line.ids), 1, "Archiving the program should remove the program reward line") -- cgit v1.2.3