diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-10-01 10:46:29 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-10-01 10:46:29 +0200 |
| commit | 3fc388c696bb918baa1d54a0b5880c0494ecc9e5 (patch) | |
| tree | d498cece31ee59a6c0acdc0f2e8dee3010166206 /tests/test_program_numbers.py | |
| parent | 47ef5cb2c0ac4fbc6a5698626b4daabfcbe3b2d6 (diff) | |
| parent | cfca60d422a19e5111b92bb9a63a720c93f15d90 (diff) | |
[MERGE] forward port branch 11.0 up to 92d7a5210d7
Diffstat (limited to 'tests/test_program_numbers.py')
| -rw-r--r-- | tests/test_program_numbers.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_program_numbers.py b/tests/test_program_numbers.py index 39f15fffb0e..01da22c1de4 100644 --- a/tests/test_program_numbers.py +++ b/tests/test_program_numbers.py @@ -453,3 +453,30 @@ class TestSaleCouponProgramNumbers(TestSaleCouponCommon): self.env['sale.coupon.apply.code'].with_context(active_id=order.id).create({ 'coupon_code': 'test_10pc' }).process_coupon() + + def test_program_fixed_price(self): + # Check fixed amount discount + order = self.empty_order + fixed_amount_program = self.env['sale.coupon.program'].create({ + 'name': '$249 discount', + 'promo_code_usage': 'no_code_needed', + 'program_type': 'promotion_program', + 'discount_type': 'fixed_amount', + 'discount_fixed_amount': 249.0, + }) + sol1 = self.env['sale.order.line'].create({ + 'product_id': self.computerCase.id, + 'name': 'Computer Case', + 'product_uom_qty': 1.0, + 'order_id': order.id, + }) + order.recompute_coupon_lines() + self.assertEqual(order.amount_total, 0, "Total should be null. The fixed amount discount is higher than the SO total, it should be reduced to the SO total") + self.assertEqual(len(order.order_line.ids), 2, "There should be the product line and the reward line") + sol1.product_uom_qty = 17 + 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") + 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") |
