[IMP]GOLEM Session Activity Registration : let removal of already canceled registrations happen

This commit is contained in:
Fabien Bourgeois 2016-10-09 12:47:08 +02:00
parent ba7aa76952
commit d13f19aed9

View File

@ -53,13 +53,13 @@ class GolemMember(models.Model):
for r in rids: # == 2 is removal case for r in rids: # == 2 is removal case
r_removed.append(r) if r[0] == 2 else r_keep.append(r) r_removed.append(r) if r[0] == 2 else r_keep.append(r)
rObj = self.env['golem.activity.session.registration'] rObj = self.env['golem.activity.session.registration']
for r in r_removed: for rem in r_removed:
r = rObj.browse([r[1]]) r = rObj.browse([rem[1]])
# if already canceled, let it be removed, else cancel it # if already canceled, let it be removed, else cancel it
if r.state != 'canceled': if r.state != 'canceled':
r.state = 'canceled' r.state = 'canceled'
else: else:
r_keep.append(r) r_keep.append(rem)
values['activity_session_registration_ids'] = r_keep values['activity_session_registration_ids'] = r_keep
return super(GolemMember, self).write(values) return super(GolemMember, self).write(values)