2017-08-16 96 views
0

我嘗試創建一個域過濾器應該是這樣的:Odoo域濾波不工作

(Followup date < today) AND (customer = TRUE OR user_id = user.id) 

我做到了像以下:

[('follow_up_date', '&lt;=', datetime.datetime.now().strftime('%Y-%m-%d 00:00:00')),['|', ('customer', '=', 'False'),('user_id', '=', 'user.id')]] 

第一部分(時間過濾器)的偉大工程,如果它是獨立的,但是當我第二部分連接它像我的例子一樣上面它給了我這個錯誤:

File "/usr/lib/python2.7/dist-packages/openerp/osv/expression.py", line 308, in distribute_not 
    elif token in DOMAIN_OPERATORS_NEGATION: 
TypeError: unhashable type: 'list' 

出了什麼問題,我該如何表達我想要的域名過濾器?

感謝您對您的幫助提前:)

回答

1

Odoo使用polish notation。如果您想使用邏輯表達式 (A) AND (B OR C)作爲域,那意味着您將不得不使用:AND A OR B C。如果您想了解更多有關波蘭語符號的信息,請查看鏈接。

這意味着,如果我理解正確的問題,你需要這樣的:

['&', ('follow_up_date', '&lt;=', datetime.datetime.now().strftime('%Y-%m-%d 00:00:00')),'|', ('customer', '=', 'False'),('user_id', '=', 'user.id')] 
0

嘗試沒有在第二個括號表示:

[('follow_up_date', '&lt;=', datetime.datetime.now().strftime('%Y-%m-%d 00:00:00')),'|', ('customer', '=', 'False'),('user_id', '=', 'user.id')'] 

我希望這可以幫助您。