[FIX] loyalty: (un)archive linked reward product

X-original-commit: b56ead874c10b7b1411eac27891bd935c68e368b
Part-of: odoo/odoo#129115
This commit is contained in:
Valentin Vallaeys (vava)
2023-07-20 13:07:11 +02:00
parent 129b5e8d8c
commit 72d1aeb127
+5
View File
@@ -232,6 +232,11 @@ class LoyaltyReward(models.Model):
# Keep the name of our discount product up to date
for reward in self:
reward.discount_line_product_id.write({'name': reward.description})
if 'active' in vals:
if vals['active']:
self.reward_product_id.action_unarchive()
else:
self.reward_product_id.action_archive()
return res
def unlink(self):