def name_search(self, name='', args=None, operator='ilike', limit=100): args = args or [] if name and operator in ('=', 'ilike', '=ilike', 'like'): if operator != '=': name = name.strip().replace(' ', '%') args += [ '|', ('codigo', '=', name), '|', ('nome', 'ilike', name), '|', ('razao_social', 'ilike', name), '|', ('fantasia', 'ilike', name), '|', ('cnpj_cpf', 'ilike', mascara(name, ' . . / - ')), ('cnpj_cpf', 'ilike', mascara(name, ' . . - ')), ] empresas = self.search(args, limit=limit) return empresas.name_get() return super(SpedEmpresa, self).name_search(name=name, args=args, operator=operator, limit=limit)
def name_search(self, name='', args=[], operator='ilike', limit=100): if name and operator in ('=', 'ilike', '=ilike', 'like'): if operator != '=': name = name.strip().replace(' ', '%') args += [ '|', ('codigo', '=', name), '|', ('razao_social', 'ilike', name), '|', ('fantasia', 'ilike', name), '|', ('cnpj_cpf', 'ilike', mascara(name, ' . . / - ')), ('cnpj_cpf', 'ilike', mascara(name, ' . . - ')), ] return super(Empresa, self).name_search(name=name, args=args, operator=operator, limit=limit)
def name_search(self, name='', args=None, operator='ilike', limit=100): if name and operator in ('=', 'ilike', '=ilike', 'like', 'ilike'): args = list(args or []) args = [ '|', ('codigo', '=', name), '|', ('codigo_formatado', '=', mascara(name, ' . . ')), ('descricao', operator, name), ] + args cest_ids = self.search(args, limit=limit) return cest_ids.name_get() return super(SpedCEST, self).name_search( name=name, args=args, operator=operator, limit=limit)