Commit f6f6a0de by François C.

#6995 et pb statut suppléant suite création binôme

parent 54208bec
...@@ -116,7 +116,7 @@ class ResPartner(models.Model): ...@@ -116,7 +116,7 @@ class ResPartner(models.Model):
self.env['shift.counter.event'].unsubscribe_partner(partner, unsubscribe_limit, points) self.env['shift.counter.event'].unsubscribe_partner(partner, unsubscribe_limit, points)
else: else:
if partner.date_alert_stop: if partner.date_alert_stop:
if partner.date_delay_stop > current_datetime: if partner.date_delay_stop and partner.date_delay_stop > current_datetime:
state = 'delay' state = 'delay'
else: else:
state = 'suspended' state = 'suspended'
...@@ -335,7 +335,10 @@ class ResPartner(models.Model): ...@@ -335,7 +335,10 @@ class ResPartner(models.Model):
if 'barcode_base' in vals: if 'barcode_base' in vals:
vals['cooperative_state'] = 'unsubscribed' vals['cooperative_state'] = 'unsubscribed'
vals['working_state'] = 'unsubscribed' vals['working_state'] = 'unsubscribed'
return super(ResPartner, self).write(vals) res = super(ResPartner, self).write(vals)
if 'barcode_base' in vals and self.parent_id:
self.recompute_member_states()
return res
@api.model @api.model
......
...@@ -12,14 +12,16 @@ class ShiftExtension(models.Model): ...@@ -12,14 +12,16 @@ class ShiftExtension(models.Model):
@api.model @api.model
def _update_member_status(self, vals): def _update_member_status(self, vals):
_logger.debug("_update_member_status, reçu %s", str(vals))
res_partner = self.env['res.partner'].search([('id', '=', vals['partner_id'])]) res_partner = self.env['res.partner'].search([('id', '=', vals['partner_id'])])
if res_partner: if res_partner:
res_partner[0].recompute_member_states() res_partner[0].recompute_member_states()
@api.model @api.multi
def write(self, vals): def write(self, vals):
_logger.debug("Shift extension Vals recues = %s", str(vals)) _logger.debug("Shift extension vals = %s, partner_id = %s", str(vals), str(self.partner_id.id))
res = super(ShiftExtension, self).write(vals) res = super(ShiftExtension, self).write(vals)
vals['partner_id'] = self.partner_id.id
self._update_member_status(vals) self._update_member_status(vals)
return res return res
......
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