From 337b9dd4d12a26032b55d4c0c37a01ea192028b9 Mon Sep 17 00:00:00 2001 From: "Jonathan Nemry (ACSONE)" Date: Wed, 23 Sep 2015 16:02:04 +0200 Subject: [PATCH] [FIX] Allow to search on non-stored field "any_partner_id" by adding a search method into the fields' declaration --- partner_relations/model/res_partner_relation.py | 8 ++++++++ partner_relations/view/res_partner_relation.xml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/partner_relations/model/res_partner_relation.py b/partner_relations/model/res_partner_relation.py index 35bc71ddf..3ebb19b05 100644 --- a/partner_relations/model/res_partner_relation.py +++ b/partner_relations/model/res_partner_relation.py @@ -41,6 +41,13 @@ class ResPartnerRelation(models.Model): _description = 'Partner relation' _order = 'active desc, date_start desc, date_end desc' + def _search_any_partner_id(self, operator, value): + return [ + '|', + ('left_partner_id', operator, value), + ('right_partner_id', operator, value), + ] + def _get_computed_fields( self, cr, uid, ids, field_names, arg, context=None): '''Return a dictionary of dictionaries, with for every partner for @@ -101,6 +108,7 @@ class ResPartnerRelation(models.Model): 'res.partner', string='Partner', compute='_get_partner_type_any', + search='_search_any_partner_id' ) left_partner_id = fields.Many2one( diff --git a/partner_relations/view/res_partner_relation.xml b/partner_relations/view/res_partner_relation.xml index 635107bb7..96bcb3982 100644 --- a/partner_relations/view/res_partner_relation.xml +++ b/partner_relations/view/res_partner_relation.xml @@ -46,7 +46,7 @@ res.partner.relation - +