feat: bypass loyalty program state reset logic during module installation and explicit context triggers
This commit is contained in:
parent
15917ee277
commit
f9233da337
@ -50,6 +50,12 @@ class LoyaltyProgram(models.Model):
|
||||
if len(vals) == 1 and 'state' in vals:
|
||||
return super().write(vals)
|
||||
|
||||
# Skip reset logic if Odoo is installing/upgrading modules or explicitly bypassed
|
||||
if (self.env.context.get('install_mode')
|
||||
or self.env.context.get('module')
|
||||
or self.env.context.get('no_marketing_reset')):
|
||||
return super().write(vals)
|
||||
|
||||
# For modifications, check if they are in pending/approved state
|
||||
programs_to_reset = self.filtered(lambda p: p.state in ['pending', 'approved'])
|
||||
if programs_to_reset:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user