[IMP][REF]CRM Action : for ation view, now see parent and all childs in domain
This commit is contained in:
parent
2c9d7cd506
commit
9377e6fe65
@ -18,7 +18,7 @@
|
||||
{
|
||||
'name': 'CRM Actions',
|
||||
'summary': 'Action management, instead of new activity, in CRM',
|
||||
'version': '10.0.1.3.0',
|
||||
'version': '10.0.1.3.1',
|
||||
'category': 'Sales',
|
||||
'author': 'Fabien BOURGEOIS - Yaltik',
|
||||
'license': 'AGPL-3',
|
||||
|
@ -47,16 +47,15 @@ class ResPartner(models.Model):
|
||||
|
||||
@api.model
|
||||
def partner_actions(self):
|
||||
""" Return action for active partner and its parent """
|
||||
""" 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)
|
||||
domain = [('partner_id', '=', partner.id)]
|
||||
if partner.parent_id or partner.child_ids:
|
||||
domain.insert(0, '|')
|
||||
if partner.parent_id:
|
||||
domain.append(('partner_id', '=', partner.parent_id.id))
|
||||
elif partner.child_ids:
|
||||
domain.append(('partner_id', 'in', partner.child_ids.ids))
|
||||
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)]
|
||||
|
||||
return {'type': 'ir.actions.act_window',
|
||||
'name': _('Actions'),
|
||||
|
Loading…
Reference in New Issue
Block a user