(self, name, args=None, operator="ilike", limit=100)
return res
Give preference to commercial names on name search, appending
        the rest of the results after. This has to be done this way, as
        Odoo overwrites name_search on res.partner in a non inheritable way.
Give preference to commercial names on name search, appending
        the rest of the results after. This has to be done this way, as
        Odoo overwrites name_search on res.partner in a non inheritable way.
Give preference to commercial names on name search appending the rest of the results after . This has to be done this way as Odoo overwrites name_search on res . partner in a non inheritable way .
def name_search(self, name, args=None, operator="ilike", limit=100):
        """Give preference to commercial names on name search, appending
        the rest of the results after. This has to be done this way, as
        Odoo overwrites name_search on res.partner in a non inheritable way."""
        if not args:
            args = []
        partners = self.search([("comercial", operator, name)] + args, limit=limit)
        res = partners.name_get()
        if limit:
            limit_rest = limit - len(partners)
        else:  # pragma: no cover
            # limit can be 0 or None representing infinite
            limit_rest = limit
        if limit_rest or not limit:
            args += [("id", "not in", partners.ids)]
            res += super().name_search(
                name, args=args, operator=operator, limit=limit_rest
            )
        return res
def name_search ( self , name , args = None , operator = "ilike" , limit = 100 ) : if not args : args = [ ] partners = self . search ( [ ( "comercial" , operator , name ) ] + args , limit = limit ) res = partners . name_get ( ) if limit : limit_rest = limit - len ( partners ) else : # pragma: no cover # limit can be 0 or None representing infinite limit_rest = limit if limit_rest or not limit : args += [ ( "id" , "not in" , partners . ids ) ] res += super ( ) . name_search ( name , args = args , operator = operator , limit = limit_rest ) return res