本文介绍了Openerp/Odoo中哪些可用的域运算符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在openerp域中了解很少的运算符.我没有获得可用域的详细信息及其解释.特别是对于这些否定域.谁能告诉我详细清单?

I know few operator in openerp domain. I dont get the details of available domains and their explanation. Particularly for these negation domains. Can anyone tell me the detail list?

推荐答案

这提供了一个概述:

运算符的列表:!(不),|(或),&(与)

List of Domain operators: ! (Not), | (Or), & (And)

术语运算符的列表:'=', '!=', '<=', '<', '>', '>=', '=?', '=like', '=ilike', 'like', 'not like', 'ilike', 'not ilike', 'in', 'not in', 'child_of'

用法:

输入记录:

记录1:Openerp

记录2:openerp

记录3:Opensource

记录4:opensource

记录5:Open

记录6:open

记录7:Odoo

记录8:odoo

记录9:Odooopenerp

记录10:OdooOpenerp

喜欢": [('input', 'like', 'open')]-返回区分大小写(通配符-'%open%')的搜索.

'like': [('input', 'like', 'open')] - Returns case sensitive (wildcards - '%open%') search.

O/p:开放,开源,openerp,Odooopenerp

O/p: open, opensource, openerp, Odooopenerp

不喜欢": [('input', 'not like', 'open')]-返回与区分大小写(通配符-'%open%')搜索不匹配的结果.

'not like': [('input', 'not like', 'open')] - Returns results not matched with case sensitive (wildcards - '%open%') search.

O/p:Openerp,Opensource,Open,Odoo,odoo,OdooOpenerp

O/p: Openerp, Opensource, Open, Odoo, odoo, OdooOpenerp

'= like': [('name', '=like', 'open')]-返回精确(='open')区分大小写的搜索.

'=like': [('name', '=like', 'open')] - Returns exact (= 'open') case sensitive search.

O/p:打开

'ilike': [('name', 'ilike', 'open')]-返回不区分大小写(通配符-'%open%')的精确搜索.

'ilike': [('name', 'ilike', 'open')] - Returns exact case insensitive (wildcards - '%open%') search.

O/p:Openerp,openerp,Opensource,opensource,Open,Open,Odooopenerp,OdooOpenerp

O/p: Openerp, openerp, Opensource, opensource, Open, open, Odooopenerp, OdooOpenerp

不喜欢": [('name', 'not ilike', 'open')]-返回与大小写不敏感(通配符-'%open%')搜索不匹配的结果.

'not ilike': [('name', 'not ilike', 'open')] - Returns results not matched with exact case insensitive (wildcards - '%open%') search.

O/p:Odoo,odoo

O/p: Odoo, odoo

'= ilike': [('name', '=ilike', 'open')]-返回不区分大小写的精确(='open'或'Open')搜索.

'=ilike': [('name', '=ilike', 'open')] - Returns exact (= 'open' or 'Open') case insensitive search.

O/p:打开,打开

'=?':

name ='odoo'parent_id =假[('name', 'like', name), ('parent_id', '=?', parent_id)]-返回名称域结果&是

name = 'odoo'parent_id = False[('name', 'like', name), ('parent_id', '=?', parent_id)] - Returns name domain result & True

name ='odoo'parent_id ='openerp'[('name', 'like', name), ('parent_id', '=?', parent_id)]-返回名称域结果& parent_id域结果

name = 'odoo'parent_id = 'openerp'[('name', 'like', name), ('parent_id', '=?', parent_id)] - Returns name domain result & parent_id domain result

'=?'是一种短路,如果right为None或False,则术语TRUE,在其他情况下,'=?'的行为类似于'='

'=?' is a short-circuit that makes the term TRUE if right is None or False, '=?' behaves like '=' in other cases

输入":[('value1', 'in', ['value1', 'value2'])]-运算符in会检查右边项列表中是否存在value1

'in':[('value1', 'in', ['value1', 'value2'])] - in operator will check the value1 is present or not in list of right term

不在":[('value1', 'not in', ['value2'])]-不在运算符中将检查右边项列表中不存在value1虽然这些输入"和不在"适用于值列表/元组,但后者'=''!='使用字符串

'not in':[('value1', 'not in', ['value2'])] - not in operator will check the value1 is not present in list of right termWhile these 'in' and 'not in' works with list/tuple of values, the latter '=' and '!=' works with string

'=':价值= 10[('value','=',value)]-术语左侧在db中有10,而术语右侧我们的值10将匹配

'=':value = 10[('value','=',value)] - term left side has 10 in db and term right our value 10 will match

'!=':值= 15[('value','!=',value)]-术语左侧在db中有10,而术语右侧我们的值10不匹配

'!=':value = 15[('value','!=',value)] - term left side has 10 in db and term right our value 10 will not match

"child_of":parent_id ='1'#Agrolait'child_of':[('partner_id', 'child_of', parent_id)]-返回给定parent_id的partner_id左右列表

'child_of':parent_id = '1' #Agrolait'child_of':[('partner_id', 'child_of', parent_id)] - return left and right list of partner_id for given parent_id

'< =','<','>','> =':这些运算符在openerp中大量用于比较日期-[('date', '>=', date_begin), ('date', '<=', date_end)].您可以使用这些运算符来比较int或float.

'<=', '<', '>', '>=':These operators are largely used in openerp for comparing dates - [('date', '>=', date_begin), ('date', '<=', date_end)]. You can use these operators to compare int or float also.

这篇关于Openerp/Odoo中哪些可用的域运算符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 06:14