[IMP]CRM Action : usage of child_of operator
This commit is contained in:
parent
9377e6fe65
commit
6b02ae1053
@ -50,12 +50,8 @@ class ResPartner(models.Model):
|
||||
""" Return action for active partner and its parent and childs """
|
||||
active_id = self._context.get('active_id')
|
||||
partner = self.env['res.partner'].browse(active_id)
|
||||
if partner.parent_id:
|
||||
partner_ids = [partner.parent_id.id] + partner.parent_id.child_ids.ids
|
||||
domain = [('partner_id', 'in', partner_ids)]
|
||||
elif partner.child_ids:
|
||||
partner_ids = [partner.id] + partner.child_ids.ids
|
||||
domain = [('partner_id', 'in', partner_ids)]
|
||||
parent_id = partner.parent_id.id if partner.parent_id else partner.id
|
||||
domain = [('partner_id', 'child_of', parent_id)]
|
||||
|
||||
return {'type': 'ir.actions.act_window',
|
||||
'name': _('Actions'),
|
||||
|
Loading…
x
Reference in New Issue
Block a user