[REF]GOLEM Member / Family Membership for minors
Ensures that, is family is not installed, only guardians are handled.
This commit is contained in:
parent
f7ceab753f
commit
596ec855e8
@ -20,7 +20,7 @@
|
||||
'name': 'GOLEM Family Memberships',
|
||||
'summary': 'GOLEM Family Membership Management',
|
||||
'description': 'GOLEM Family Membership Management',
|
||||
'version': '10.0.0.1.2',
|
||||
'version': '10.0.0.1.3',
|
||||
'category': 'GOLEM',
|
||||
'author': 'Fabien Bourgeois, Youssef ELOUAHBY',
|
||||
'license': 'AGPL-3',
|
||||
|
@ -47,6 +47,20 @@ class GolemMembershipInvoice(models.TransientModel):
|
||||
}
|
||||
return {'domain': {'on_the_name_of': []}}
|
||||
|
||||
@api.onchange('src_member_id')
|
||||
def onchange_member(self):
|
||||
""" Set partner domain if src_member_id is filled """
|
||||
self.ensure_one()
|
||||
record = self[0]
|
||||
res = super(GolemMembershipInvoice, self).onchange_member()
|
||||
if record.src_member_id.family_member_ids:
|
||||
guardian_ids = res['domain']['partner_id'][0][2]
|
||||
partner_ids = record.src_member_id.family_member_ids.filtered(
|
||||
lambda r: r.id != self.src_member_id.partner_id.id
|
||||
).ids
|
||||
res['domain']['partner_id'] = [('id', 'in', guardian_ids + partner_ids)]
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
def membership_family_invoice(self):
|
||||
""" Create family membership """
|
||||
|
@ -19,7 +19,7 @@
|
||||
{
|
||||
'name': 'GOLEM members minor',
|
||||
'summary': 'GOLEM non-profit members minor management',
|
||||
'version': '10.0.1.3.0',
|
||||
'version': '10.0.1.3.1',
|
||||
'category': 'GOLEM',
|
||||
'author': 'Fabien Bourgeois',
|
||||
'license': 'AGPL-3',
|
||||
|
@ -34,14 +34,10 @@ class GolemMembershipInvoice(models.TransientModel):
|
||||
""" Set partner domain if src_member_id is filled """
|
||||
self.ensure_one()
|
||||
record = self[0]
|
||||
if record.src_member_id.is_minor:
|
||||
partner_ids = record.src_member_id.mapped('legal_guardian_ids.legal_guardian_id').ids
|
||||
else:
|
||||
partner_ids = []
|
||||
if hasattr(record.src_member_id, 'family_member_ids'):
|
||||
partner_ids += record.src_member_id.family_member_ids.filtered(
|
||||
lambda r: r.id != self.src_member_id.partner_id.id).ids
|
||||
return {'domain': {'partner_id': [('id', 'in', partner_ids)]}}
|
||||
domain = ([('id', 'in',
|
||||
record.src_member_id.mapped('legal_guardian_ids.legal_guardian_id').ids)]
|
||||
if record.src_member_id.is_minor else [])
|
||||
return {'domain': {'partner_id': domain}}
|
||||
|
||||
@api.multi
|
||||
def membership_invoice(self):
|
||||
|
Loading…
Reference in New Issue
Block a user