Commit 7143b801 by François C.

FIX unset target_status bug

parent 6b8faccc
......@@ -20,16 +20,18 @@ class ShiftCounterEvent(models.Model):
p = res_partner[0]
points_before_removing_points = p.final_ftop_point if p.shift_type == "ftop" else p.final_standard_point
points_after_removal = points_before_removing_points + vals['point_qty']
_logger.info("points_after_removal = %s", str(points_after_removal))
_logger.info("points_after_removal = %s, current_state = %s", str(points_after_removal), p.cooperative_state)
if points_after_removal <= suspension_limit or points_after_removal <= unsubscribe_limit:
target_status = None
if (points_after_removal <= suspension_limit
and
p.cooperative_state != 'delay'):
target_status = 'suspended'
if points_after_removal <= unsubscribe_limit:
target_status = 'unsubscribed'
p.update({'target_status': target_status,
'current_cooperative_state': p.cooperative_state})
if target_status is not None:
p.update({'target_status': target_status,
'current_cooperative_state': p.cooperative_state})
@api.model
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