summaryrefslogtreecommitdiff
path: root/tests/test_program_rules.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-03-02 17:55:33 +0100
committerChristophe Simonis <chs@odoo.com>2018-03-02 17:55:33 +0100
commit34ee72f7c05bf23ee878f32802f1e16ff106fac1 (patch)
treef503f88d827ee3d2d31e6a66130a790e21bb4b72 /tests/test_program_rules.py
parent5c81da008815f9a3f261f66cad533fc549c14b16 (diff)
parent11a089969f67bb2f7a05728097d10d9201e52d2c (diff)
[MERGE] forward port branch 11.0 up to 10886317711
Diffstat (limited to 'tests/test_program_rules.py')
-rw-r--r--tests/test_program_rules.py17
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