diff --git a/partner_multi_relation/models/res_partner.py b/partner_multi_relation/models/res_partner.py index d9ab05e75..05ea382b7 100644 --- a/partner_multi_relation/models/res_partner.py +++ b/partner_multi_relation/models/res_partner.py @@ -171,3 +171,23 @@ class ResPartner(models.Model): """ self.ensure_one() return 'c' if self.is_company else 'p' + + @api.multi + def action_view_relations(self): + for contact in self: + relation_ids = self.env['res.partner.relation.all'].\ + search(['|', ('this_partner_id', '=', contact.id), + ('other_partner_id', '=', contact.id)]) + action = self.env.\ + ref('partner_multi_relation.action_res_partner_relation_all').\ + read()[0] + action['context'] = {} + action['domain'] = [('id', 'in', relation_ids.ids)] + action['context'].\ + update({'search_default_this_partner_id': contact.id, + 'default_this_partner_id': contact.id, + 'active_model': 'res.partner', + 'active_id': contact.id, + 'active_ids': [contact.id], + 'active_test': False}) + return action diff --git a/partner_multi_relation/views/res_partner.xml b/partner_multi_relation/views/res_partner.xml index 6c7c3087c..f3977c86d 100644 --- a/partner_multi_relation/views/res_partner.xml +++ b/partner_multi_relation/views/res_partner.xml @@ -21,25 +21,13 @@ res.partner -