Commit fac232e5 by François C.

#7151 : Statut suite à réinscription d'un membre 'parti.e'

parent 1f68d0ab
...@@ -84,6 +84,7 @@ class ResPartner(models.Model): ...@@ -84,6 +84,7 @@ class ResPartner(models.Model):
for partner in self: for partner in self:
_logger.debug("partner_id = %s, cooperative_state = %s", str(partner.id), str(partner.cooperative_state)) _logger.debug("partner_id = %s, cooperative_state = %s", str(partner.id), str(partner.cooperative_state))
state = 'up_to_date' state = 'up_to_date'
if partner.leave_ids: if partner.leave_ids:
is_exempted = partner.leave_ids.filtered( is_exempted = partner.leave_ids.filtered(
lambda l: l.state == 'done' and l.start_date <= current_datetime and l.stop_date >= lambda l: l.state == 'done' and l.start_date <= current_datetime and l.stop_date >=
...@@ -97,6 +98,12 @@ class ResPartner(models.Model): ...@@ -97,6 +98,12 @@ class ResPartner(models.Model):
state = partner.parent_id.cooperative_state state = partner.parent_id.cooperative_state
else: else:
if partner.cooperative_state in ['gone', 'associated']: if partner.cooperative_state in ['gone', 'associated']:
if partner.cooperative_state == 'gone' and partner.is_unsubscribed is False:
# the coop member came back and has now a shift template registration
if (partner.shift_type == 'standard' and partner.final_standard_point <= 0)\
or (partner.shift_type == 'ftop' and partner.final_ftop_point <= 0) :
state = 'suspended'
else:
state = partner.cooperative_state state = partner.cooperative_state
else: else:
potential_associated_record = self.env['res.partner'].search([('email','=',self.email), ('is_associated_people', '=', True)]) potential_associated_record = self.env['res.partner'].search([('email','=',self.email), ('is_associated_people', '=', True)])
......
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