Browse Source

Merge pull request #175 from acsone/8.0-fix-allow_search_on_any_partner-jne

[8.0][partner_relations - FIX] Allow to search on non-stored field "any_partner_id" by adding …
pull/181/head
Pedro M. Baeza 9 years ago
parent
commit
e68a23831c
  1. 8
      partner_relations/model/res_partner_relation.py
  2. 2
      partner_relations/view/res_partner_relation.xml

8
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(

2
partner_relations/view/res_partner_relation.xml

@ -46,7 +46,7 @@
<field name="model">res.partner.relation</field>
<field name="arch" type="xml">
<search string="Search Relations">
<field name="any_partner_id"/>
<field name="any_partner_id" widget="many2one"/>
<field name="left_partner_id"/>
<field name="right_partner_id"/>
<field name="type_id"/>

Loading…
Cancel
Save