Browse Source
Merge pull request #119 from coopiteasy/12.0-fix-view-representatives
[12.0] [FIX] view representatives
pull/122/head
12.0-2020-08-21.00
Rémy Taymans
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
21 additions and
1 deletions
-
easy_my_coop/models/partner.py
-
easy_my_coop/views/res_partner_view.xml
|
|
@ -172,6 +172,11 @@ class ResPartner(models.Model): |
|
|
|
sting="Effective Date", compute=_compute_effective_date, store=True |
|
|
|
) |
|
|
|
representative = fields.Boolean(string="Legal Representative") |
|
|
|
representative_of_member_company = fields.Boolean( |
|
|
|
string="Legal Representative of Member Company", |
|
|
|
store=True, |
|
|
|
compute="_compute_representative_of_member_company", |
|
|
|
) |
|
|
|
subscription_request_ids = fields.One2many( |
|
|
|
"subscription.request", "partner_id", string="Subscription request" |
|
|
|
) |
|
|
@ -194,6 +199,21 @@ class ResPartner(models.Model): |
|
|
|
|
|
|
|
partner.coop_candidate = is_candidate |
|
|
|
|
|
|
|
@api.multi |
|
|
|
@api.depends("parent_id", "representative") |
|
|
|
def _compute_representative_of_member_company(self): |
|
|
|
for partner in self: |
|
|
|
member_companies = self.env["res.partner"].search( |
|
|
|
[("is_company", "=", True), ("member", "=", True)] |
|
|
|
) |
|
|
|
partner.representative_of_member_company = ( |
|
|
|
partner in member_companies.mapped( |
|
|
|
"child_ids" |
|
|
|
).filtered( |
|
|
|
"representative" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
@api.multi |
|
|
|
def has_representative(self): |
|
|
|
self.ensure_one() |
|
|
|
|
|
@ -195,7 +195,7 @@ |
|
|
|
<field name="res_model">res.partner</field> |
|
|
|
<field name="view_type">form</field> |
|
|
|
<field name="view_mode">kanban,tree,form</field> |
|
|
|
<field name="domain">[('cooperator','=',True),('representative','=',True)]</field> |
|
|
|
<field name="domain">[('representative_of_member_company','=',True)]</field> |
|
|
|
<field name="filter" eval="True"/> |
|
|
|
<field name="help" type="html"> |
|
|
|
<p class="oe_view_nocontent_create"> |
|
|
|