[FIX] pos_coupon: Make sure loyalty rewards are considered as rewards
Current behavior: When a loyalty reward was applied with a promotion program, a promotion reward was added with a -Infinity value. Steps to reproduce: - Create a loyalty program with a reward of 5€ fixed amount for 50 points - Create a promotion program with a reward of 10% discount - Open a pos session, select a customer (and add points to the loyalty program if needed). - Add a product to the order, the 10% discount should be applied - Now click on the reward button to apply the loyalty reward - The loyalty reward is correctly applied, but a new promotion reward is added with a -Infinity value. opw-3297817 closes odoo/odoo#133550 X-original-commit: ee60da301209c84264d706b9d16e45af541a3bbf Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com> Signed-off-by: Robin Engels (roen) <roen@odoo.com>
This commit is contained in:
@@ -179,3 +179,20 @@ registry.category("web_tour.tours").add("PosLoyaltyLoyaltyProgram3", {
|
||||
return getSteps();
|
||||
},
|
||||
});
|
||||
|
||||
registry.category("web_tour.tours").add("PosLoyaltyPromotion", {
|
||||
test: true,
|
||||
url: "/pos/web",
|
||||
steps: () => {
|
||||
startSteps();
|
||||
|
||||
ProductScreen.do.clickHomeCategory();
|
||||
ProductScreen.do.confirmOpeningPopup();
|
||||
|
||||
ProductScreen.do.clickPartnerButton();
|
||||
ProductScreen.do.clickCustomer('AAA Partner');
|
||||
ProductScreen.exec.addOrderline('Test Product 1', '1.00', '100');
|
||||
ProductScreen.check.totalAmountIs('80.00');
|
||||
return getSteps();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1180,3 +1180,82 @@ class TestUi(TestPointOfSaleHttpCommon):
|
||||
"PosLoyaltySpecificDiscountWithRewardProductDomainTour",
|
||||
login="pos_user",
|
||||
)
|
||||
|
||||
def test_promotion_program_with_loyalty_program(self):
|
||||
"""
|
||||
- Create a promotion with a discount of 10%
|
||||
- Create a loyalty program with a fixed discount of 10€
|
||||
- Apply both programs to the order
|
||||
- Check that no "infinity" discount is applied
|
||||
"""
|
||||
self.env['loyalty.program'].search([]).write({'active': False})
|
||||
self.promo_program = self.env['loyalty.program'].create({
|
||||
'name': 'Promo Program',
|
||||
'program_type': 'promotion',
|
||||
'pos_ok': True,
|
||||
'rule_ids': [(0, 0, {
|
||||
'minimum_amount': 0,
|
||||
'minimum_qty': 0
|
||||
})],
|
||||
'reward_ids': [(0, 0, {
|
||||
'reward_type': 'discount',
|
||||
'discount': 10,
|
||||
'discount_mode': 'percent',
|
||||
'discount_applicability': 'order',
|
||||
})],
|
||||
})
|
||||
|
||||
self.discount_product = self.env["product.product"].create(
|
||||
{
|
||||
"name": "Discount Product",
|
||||
"type": "service",
|
||||
"list_price": 0,
|
||||
"available_in_pos": True,
|
||||
"taxes_id": False,
|
||||
}
|
||||
)
|
||||
|
||||
self.test_product = self.env["product.product"].create(
|
||||
{
|
||||
"name": "Test Product 1",
|
||||
"type": "product",
|
||||
"list_price": 100,
|
||||
"available_in_pos": True,
|
||||
"taxes_id": False,
|
||||
}
|
||||
)
|
||||
|
||||
self.loyalty_program = self.env["loyalty.program"].create(
|
||||
{
|
||||
"name": "Loyalty Program",
|
||||
"program_type": "loyalty",
|
||||
"pos_ok": True,
|
||||
"rule_ids": [(0, 0, {
|
||||
"minimum_amount": 1,
|
||||
"minimum_qty": 1,
|
||||
"reward_point_mode": "order",
|
||||
"reward_point_amount": 500,
|
||||
})],
|
||||
"reward_ids": [(0, 0, {
|
||||
"required_points": 500,
|
||||
"reward_type": "discount",
|
||||
"discount": "10",
|
||||
"discount_mode": "per_order",
|
||||
})],
|
||||
}
|
||||
)
|
||||
|
||||
partner = self.env['res.partner'].create({'name': 'AAA Partner'})
|
||||
self.env['loyalty.card'].create({
|
||||
'partner_id': partner.id,
|
||||
'program_id': self.loyalty_program.id,
|
||||
'points': 500,
|
||||
})
|
||||
|
||||
self.main_pos_config.open_ui()
|
||||
|
||||
self.start_tour(
|
||||
"/pos/web?config_id=%d" % self.main_pos_config.id,
|
||||
"PosLoyaltyPromotion",
|
||||
login="pos_user",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user