Commit 2f19b44e by Damien Moulard

add security to ensure points will be added

parent 6f151f38
...@@ -11,6 +11,7 @@ class ShiftCounterEvent(models.Model): ...@@ -11,6 +11,7 @@ class ShiftCounterEvent(models.Model):
def _update_partner_target_status(self, vals): def _update_partner_target_status(self, vals):
"""actions when points are removed or added""" """actions when points are removed or added"""
try:
conf = self.env['ir.config_parameter'] conf = self.env['ir.config_parameter']
suspension_limit = int(conf.get_param("lacagette_membership.points_limit_to_get_suspended")) suspension_limit = int(conf.get_param("lacagette_membership.points_limit_to_get_suspended"))
unsubscribe_limit = int(conf.get_param("lacagette_membership.points_limit_to_get_unsubscribed")) unsubscribe_limit = int(conf.get_param("lacagette_membership.points_limit_to_get_unsubscribed"))
...@@ -32,6 +33,9 @@ class ShiftCounterEvent(models.Model): ...@@ -32,6 +33,9 @@ class ShiftCounterEvent(models.Model):
if target_status is not None: if target_status is not None:
p.update({'target_status': target_status, p.update({'target_status': target_status,
'current_cooperative_state': p.cooperative_state}) 'current_cooperative_state': p.cooperative_state})
except Exception as e:
# don't block process if an error occurs here
_logger.error("Error during _update_partner_target_status : %s", str(e))
@api.model @api.model
def write(self, vals): def write(self, vals):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment