2017-08-16 95 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')'] 

我希望这可以帮助您。