From 5450f50e35101e772e8af77bb1c84ad3fdfc69c8 Mon Sep 17 00:00:00 2001 From: roen-odoo Date: Tue, 8 Feb 2022 14:07:49 +0000 Subject: [PATCH] [FIX] pos_gift_card: Access error gift card Current behavior: When trying to open the gift card list you get an access error if one of the cards has been used in another company. This error appears because you cannot access SO from another company and the used gift cards were linked to a SO. So shouldn't be able to use a gift card that was created in another company. Steps to reproduce: -Create a gift card in company A -Use it in company B -Try to access it from company A opw-2732973 closes odoo/odoo#84584 X-original-commit: 37d2178263d0c3875c603c5e6c53118f7a518b32 Signed-off-by: Masereel Pierre --- addons/pos_gift_card/models/gift_card.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/pos_gift_card/models/gift_card.py b/addons/pos_gift_card/models/gift_card.py index e7611049d53..fcde18d10c8 100644 --- a/addons/pos_gift_card/models/gift_card.py +++ b/addons/pos_gift_card/models/gift_card.py @@ -21,7 +21,7 @@ class GiftCard(models.Model): def _compute_balance(self): super()._compute_balance() for record in self: - confirmed_line = record.redeem_pos_order_line_ids.filtered( + confirmed_line = record.redeem_pos_order_line_ids.sudo().filtered( lambda l: l.order_id.state in ('paid', 'done', 'invoiced') ) balance = record.balance