Commit d7c64f69 by Yvon Kerdoncuff

manualy recompute status after performing makeup operation only

parent 252f9b15
Pipeline #4084 canceled with stage
...@@ -462,6 +462,8 @@ def update_members_makeups_core(members_data, res = None): ...@@ -462,6 +462,8 @@ def update_members_makeups_core(members_data, res = None):
# otherwise this is handled automatically by odoo when points are changed # otherwise this is handled automatically by odoo when points are changed
if member_data["points_diff"] > 0: if member_data["points_diff"] > 0:
update_makeups_res = cm.update_member_makeups(member_data) update_makeups_res = cm.update_member_makeups(member_data)
# No need to manually call status recompute after that because we update member point
# (and this triggers status update in odoo).
if res: if res:
res["res"].append(update_makeups_res) res["res"].append(update_makeups_res)
......
...@@ -1060,7 +1060,8 @@ class CagetteMember(models.Model): ...@@ -1060,7 +1060,8 @@ class CagetteMember(models.Model):
'mid': self.id, 'mid': self.id,
'update': res_item 'update': res_item
} }
# No need to manually call status recompute after that because when we use this method,
# we always call an odoo method that triggers status update after that
return res return res
......
...@@ -340,8 +340,11 @@ class CagetteShift(models.Model): ...@@ -340,8 +340,11 @@ class CagetteShift(models.Model):
[partner_id], [partner_id],
{"makeups_to_do": self.get_member_makeups_to_do(partner_id) - 1} {"makeups_to_do": self.get_member_makeups_to_do(partner_id) - 1}
) )
# Usually not needed because another odoo method that automaticaly triggers status recompute is
# often called after a makeup change, manual update IS REQUIRED here.
self.o_api.execute('res.partner', 'recompute_member_states', [partner_id])
except Exception as e: except Exception as e:
coop_logger.error("Decrement makeups to do : %s, %s", str(e), str(data)) coop_logger.error("Decrement makeups to do and recompute member states : %s, %s", str(e), str(data))
return st_r_id, res_decrement return st_r_id, res_decrement
......
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