Browse Source

Merge pull request #14 from coopiteasy/9.0_add_option_to_wizard

[IMP] add filter on sub requests
pull/17/head
Houssine BAKKALI 5 years ago
committed by GitHub
parent
commit
69744b14c0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      easy_my_coop/wizard/update_partner_info.py

11
easy_my_coop/wizard/update_partner_info.py

@ -33,6 +33,7 @@ class PartnerUpdateInfo(models.TransientModel):
partner_obj = self.env['res.partner'] partner_obj = self.env['res.partner']
cooperator = self.cooperator cooperator = self.cooperator
coop_vals = {} coop_vals = {}
req_filter = "lambda r: r.type == 'done'"
if self.all: if self.all:
if self.legal_form or self.representative_function: if self.legal_form or self.representative_function:
@ -40,8 +41,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(req_filter)
if sub_reqs:
sub_req = sub_reqs
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)
@ -54,8 +56,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(req_filter)
if sub_reqs:
sub_req = sub_reqs
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