0
votes

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

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

I did it like following:

[('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?

Thank you for your help in advance :)

2

2 Answers

1
votes

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')]
0
votes

Try without brackets in the second expression:

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

I hope this help you.