2013-10-16 42 views
0

下面的工作是什麼,我需要做的與「&」域濾波不openerp7

(Condition A and Condition B) or Condition C 

(partner_id = partner_id **and** user_ids = context.get(uid)) **or** userid = 1 

我已經試過可能域濾波器

domain="['|',('user_ids','=',1),'&',('partner_id','=',partner_id),('user_ids','=',context.get('uid'))]" 

domain="['|','&',('partner_id','=',partner_id),('user_ids','=',context.get('uid')),('user_ids','=',1)]" 

沒有什麼工作了和錯誤我得到的是下面

File "D:\workspace\Techtalk\openerp\modules\loading.py", line 76, in <lambda> 
    load_data = lambda *args: _load_data(cr, *args, kind='data') 
File "D:\workspace\Techtalk\openerp\modules\loading.py", line 124, in _load_data 
    tools.convert_xml_import(cr, module_name, fp, idref, mode, noupdate, report) 
File "D:\workspace\Techtalk\openerp\tools\convert.py", line 941, in convert_xml_import 
    doc = etree.parse(xmlfile) 
File "lxml.etree.pyx", line 2698, in lxml.etree.parse (src/lxml/lxml.etree.c:49590) 
File "parser.pxi", line 1513, in lxml.etree._parseDocument (src/lxml/lxml.etree.c:71423) 
File "parser.pxi", line 1543, in lxml.etree._parseFilelikeDocument (src/lxml/lxml.etree.c:71733) 
File "parser.pxi", line 1426, in lxml.etree._parseDocFromFilelike (src/lxml/lxml.etree.c:70648) 
File "parser.pxi", line 997, in lxml.etree._BaseParser._parseDocFromFilelike (src/lxml/lxml.etree.c:67944) 
File "parser.pxi", line 539, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:63820) 
File "parser.pxi", line 625, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:64741) 
File "parser.pxi", line 565, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:64084) 
XMLSyntaxError: xmlParseEntityRef: no name, line 144, column 12 

鏈接我已經refered是

http://help.openerp.com/question/2170/domain-notation-using-multiple-and-nested-and/

OpenERP ver 7 Domain filter with more conditions

其他注意事項 我無法在OpenERP的源&運營商找到一個域濾波器。

我錯過了什麼?請建議。謝謝你的時間。

回答

4

錯誤消息表明您的XML包含一個無效實體,即一個裸號&符號&字符。由於它是預定義的XML實體,因此您必須將其轉義爲&amp;

爲什麼你可能不會在OpenERP的源代碼中使用&發現許多領域的原因是因爲AND (&)運算符是默認的,所以你可以在大多數情況下,完全忽略它。這很方便,因爲這個逃跑的問題。 儘管如此,當您將OR/AND運算符組合時,您可能需要找到高級安全規則中的示例,這些規則也使用相同的域語法,如here

一般來說,如果你想(A and B) or C你的確可以把它寫成:

['|',C,'&',A,B] 

這意味着您的XML文件應包含:

['|',C,'&amp;',A,B]