In addition of the classic leafs, you can add operators.
« Wait... what do you name leafs? »
A leaf, is a tuple of 3 elements composed of:
- a field name
- an operator (as string)
- a value
('active', '=', True)
('foo', '!=', 'bar')
('id', 'in', [7, 13, 42, 666])
('id', '=', False)
('name', 'like', 'tiny')
« And which operators are allowed? »
Like the last week notation, the AND ('&') and OR ('|') operators are allowed . Unlike the last week notation, the arity of these operators is fixed to 2.
And yes, the one you have all been waiting for is now in: The NOT ('!') operator. This one has an arity of 1.
For compatibility with existing domains, the AND operator is applied by default.
« So, what looks like this new new notation? »
Some examples:
['&', ('active', '=', True), ('value', '!=', 'foo')]
['|', ('active', '=', True), ('state', 'in', ['open', 'draft'])
['&', ('active', '=', True), '|', '!', ('state', '=', 'closed'), ('state', '=', 'draft')]
['|', '|', ('state', '=', 'open'), ('state', '=', 'closed'), ('state', '=', 'draft')]
['!', '&', '!', ('id', 'in', [42, 666]), ('active', '=', False)]
PS: Tanks to Najlâa and Olivier for the review.
8 comments:
really great work, i am reading your code in expression.py and i want to know if is posible support BETWEEN command there, so i am debbuging that, but if you can help me with any info, thanks
regards,
did not understand.
I need to invert the expression of 2 and
(
( 'mmt_rev', '=' , 1) , ('state', '=', 'd')
)
Please help
Please give me a sample for company -> division -> department
go through more posts & samples.but unable to implement that yet
thanks friend..
Hi,
I have a problem on specifying the domain condition. Please help me.
[([1,2,3],'?',[1])]
1) [1,2,3] is a many2many field
2) '?' want to know which operator to use
3)[1] is one of the values in the many2many feild
Please help me in this
Wow i can say that this is another great article as expected of this blog.Bookmarked this site..
best web hosting
Many blogs like this cover subjects that just aren’t covered by magazines.
offshoreservers.net
Post a Comment