22# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
33
44from odoo import api , fields , models
5+ from odoo .osv .expression import FALSE_DOMAIN , TRUE_DOMAIN
56
67
78class ResCompany (models .Model ):
@@ -11,11 +12,13 @@ class ResCompany(models.Model):
1112 string = "Partner Properties (company)" ,
1213 compute = "_compute_partner_properties_definition_company" ,
1314 inverse = "_inverse_partner_properties_definition_company" ,
15+ search = "_search_partner_properties_definition_company" ,
1416 )
1517 partner_properties_definition_person = fields .PropertiesDefinition (
1618 string = "Partner Properties (person)" ,
1719 compute = "_compute_partner_properties_definition_person" ,
1820 inverse = "_inverse_partner_properties_definition_person" ,
21+ search = "_search_partner_properties_definition_person" ,
1922 )
2023
2124 @api .depends_context ("company" )
@@ -56,6 +59,22 @@ def _inverse_partner_properties_definition_person(self):
5659 )
5760 ICP .sudo ().set_param ("partner_property.properties_definition_person" , value )
5861
62+ def _search_partner_properties_definition_company (self , operator , value ):
63+ if operator not in ("=" , "!=" ) or value is not False : # pragma: no cover
64+ raise NotImplementedError ("Only = and != operators are supported" )
65+ ICP = self .env ["ir.config_parameter" ]
66+ value = ICP .sudo ().get_param ("partner_property.properties_definition_company" )
67+ condition = operator == "!=" and bool (value ) or not value
68+ return condition and TRUE_DOMAIN or FALSE_DOMAIN
69+
70+ def _search_partner_properties_definition_person (self , operator , value ):
71+ if operator not in ("=" , "!=" ) or value is not False : # pragma: no cover
72+ raise NotImplementedError ("Only = and != operators are supported" )
73+ ICP = self .env ["ir.config_parameter" ]
74+ value = ICP .sudo ().get_param ("partner_property.properties_definition_person" )
75+ condition = operator == "!=" and bool (value ) or not value
76+ return condition and TRUE_DOMAIN or FALSE_DOMAIN
77+
5978 @api .model
6079 def web_search_read (
6180 self , domain , specification , offset = 0 , limit = None , order = None , count_limit = None
0 commit comments