diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-03-09 15:22:07 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-03-09 16:27:28 +0100 |
| commit | 3e8443b5de2f4806839c35653ee77d66b37595d4 (patch) | |
| tree | 5a41c271f7a3ae30d7b8f673c755fb38aefae077 /tests/test_program_rules.py | |
| parent | 5bb0318ab4477a0dd5243e4f393867b19ac50a53 (diff) | |
| parent | f6e09b241f7ad02378cb00e499a9ff221c7a1c23 (diff) | |
[MERGE] forward port branch saas-11.2 up to cd34fda4ba3
Diffstat (limited to 'tests/test_program_rules.py')
| -rw-r--r-- | tests/test_program_rules.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/tests/test_program_rules.py b/tests/test_program_rules.py index 17018dd49fd..181b5adb07e 100644 --- a/tests/test_program_rules.py +++ b/tests/test_program_rules.py @@ -55,7 +55,7 @@ class TestProgramRules(TestSaleCouponCommon): # Test case: Based on the minimum purchased self.immediate_promotion_program.write({ - 'rule_minimum_amount': 1000.0, + 'rule_minimum_amount': 1006, 'rule_minimum_amount_tax_inclusion': 'tax_excluded' }) @@ -81,7 +81,7 @@ class TestProgramRules(TestSaleCouponCommon): order.write({'order_line': [ (0, False, { 'product_id': self.product_A.id, - 'name': '1 Product A', + 'name': '10 Product A', 'product_uom': self.uom_unit.id, 'product_uom_qty': 10.0, }), @@ -93,7 +93,18 @@ class TestProgramRules(TestSaleCouponCommon): }) ]}) order.recompute_coupon_lines() - self.assertEqual(len(order.order_line.ids), 3, "The promo offert should have been applied as the purchased amount is enough") + # 10*100 + 5 = 1005 + self.assertEqual(len(order.order_line.ids), 2, "The promo offert should not be applied as the purchased amount is not enough") + + self.immediate_promotion_program.rule_minimum_amount = 1005 + order.recompute_coupon_lines() + self.assertEqual(len(order.order_line.ids), 3, "The promo offert should be applied as the purchased amount is now enough") + + # 10*(100*1.15) + (5*1.15) = 10*115 + 5.75 = 1155.75 + self.immediate_promotion_program.rule_minimum_amount = 1006 + self.immediate_promotion_program.rule_minimum_amount_tax_inclusion = 'tax_included' + order.recompute_coupon_lines() + self.assertEqual(len(order.order_line.ids), 3, "The promo offert should be applied as the initial amount required is now tax included") def test_program_rules_validity_dates_and_uses(self): # Test case: Based on the validity dates and the number of allowed uses |
