Odoo 域过滤器不起作用 [英] Odoo domain filter isn't working

查看:140
本文介绍了Odoo 域过滤器不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试创建一个域过滤器,看起来像这样:

I try to create a domain filter what should look like this:

(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')]]

第一部分(时间过滤器)在单独使用时效果很好,但是当我像在上面的示例中那样将它与第二部分连接时,它给了我这个错误:

The first part (the time filter) works great if it stands alone, but when I connect it with the second part like I did in the example above it gives me this error:

 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'

怎么了,我该如何表达我想要的正确域过滤器?

What's wrong, how can I express what I want as a correct domain filter?

提前感谢您的帮助:)

推荐答案

Odoo 使用 抛光符号.如果你想使用逻辑表达式(A) AND (B OR C) 作为域,这意味着您必须使用:AND A OR B C.如果您想了解有关波兰语符号的更多信息,请查看链接.

Odoo uses the polish notation. If you'd like to use the logical expression (A) AND (B OR C) as a domain, that means you will have to use: AND A OR B C. If you'd like more information about polish notation please check the link.

这意味着,如果我正确理解了这个问题,您将需要这个:

This means that, if I understand the question correctly, you will need this:

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

这篇关于Odoo 域过滤器不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆