Commit 7143b801 by François C.

FIX unset target_status bug

parent 6b8faccc
...@@ -20,14 +20,16 @@ class ShiftCounterEvent(models.Model): ...@@ -20,14 +20,16 @@ class ShiftCounterEvent(models.Model):
p = res_partner[0] p = res_partner[0]
points_before_removing_points = p.final_ftop_point if p.shift_type == "ftop" else p.final_standard_point 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'] 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: if points_after_removal <= suspension_limit or points_after_removal <= unsubscribe_limit:
target_status = None
if (points_after_removal <= suspension_limit if (points_after_removal <= suspension_limit
and and
p.cooperative_state != 'delay'): p.cooperative_state != 'delay'):
target_status = 'suspended' target_status = 'suspended'
if points_after_removal <= unsubscribe_limit: if points_after_removal <= unsubscribe_limit:
target_status = 'unsubscribed' target_status = 'unsubscribed'
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})
......
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