如何在搜索过滤器中比较忽略大小写?例如,在以下代码中
ids = self.pool.get('product.product').search(cr, uid, [('name', '=', 'Service'))], context=context)我正在将产品的名称与字符串“Service”进行比较。我想比较忽略它的情况,类似于下面的情况
ids = self.pool.get('product.product').search(cr, uid, [('name'.upper(), '=', 'Service'.upper()))], context=context)我可以使用'service'.upper,但不能使用'name'.upper。那么,我如何比较忽略它的情况。耽误您时间,实在对不起。
发布于 2013-05-22 16:59:10
您可以在搜索域中使用ilike运算符而不是=。它忽略大小写。
试试这个:
ids = self.pool.get('product.product').search(cr, uid, [('name', 'ilike', 'Service'))], context=context)希望这就是你要找的。
https://stackoverflow.com/questions/16687556
复制相似问题