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.
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
ReplyDeleteregards,
did not understand.
ReplyDeleteI need to invert the expression of 2 and
(
( 'mmt_rev', '=' , 1) , ('state', '=', 'd')
)
Please help
This comment has been removed by the author.
ReplyDeletePlease give me a sample for company -> division -> department
ReplyDeletego through more posts & samples.but unable to implement that yet
thanks friend..
Hi,
ReplyDeleteI 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..
ReplyDeletebest web hosting
This comment has been removed by the author.
ReplyDeleteMany blogs like this cover subjects that just aren’t covered by magazines.
ReplyDeleteoffshoreservers.net