Browse Source

[IMP] filter on done and paid request

pull/15/head
houssine 5 years ago
parent
commit
5d5073d954
  1. 10
      easy_my_coop/wizard/update_partner_info.py

10
easy_my_coop/wizard/update_partner_info.py

@ -39,8 +39,9 @@ class PartnerUpdateInfo(models.TransientModel):
('is_company', '=', True)]) ('is_company', '=', True)])
for coop in coops: for coop in coops:
coop_vals = {} coop_vals = {}
if coop.subscription_request_ids:
sub_req = coop.subscription_request_ids[0]
sub_reqs = coop.subscription_request_ids.filtered(lambda r: r.state in ['done', 'paid'])
if sub_reqs:
sub_req = sub_reqs[0]
if self.legal_form: if self.legal_form:
coop_vals['legal_form'] = sub_req.company_type coop_vals['legal_form'] = sub_req.company_type
coop.write(coop_vals) coop.write(coop_vals)
@ -53,8 +54,9 @@ class PartnerUpdateInfo(models.TransientModel):
('is_company', '=', False)]) ('is_company', '=', False)])
for coop in coops: for coop in coops:
coop_vals = {} coop_vals = {}
if coop.subscription_request_ids:
sub_req = coop.subscription_request_ids[0]
sub_reqs = coop.subscription_request_ids.filtered(lambda r: r.state in ['done', 'paid'])
if sub_reqs:
sub_req = sub_reqs[0]
if self.birthdate: if self.birthdate:
coop_vals['birthdate_date'] = sub_req.birthdate coop_vals['birthdate_date'] = sub_req.birthdate
coop.write(coop_vals) coop.write(coop_vals)

Loading…
Cancel
Save