openerp-community team mailing list archive
-
openerp-community team
-
Mailing list archive
-
Message #06225
Re: advanced logical domain oeration
*Gustavo, first of all, thank you a LOT for your brainshare.*
>
> - In OpenERP a one2many or many2one set in a list is treated as True
> as long one of the elements of the field is contained in the list.
>
> Thanks for this acclaration I ignored the "as long as one" part so far.
This means that the openerp "in" has nothing to do with subsets in neither
direction. This automatically means, the proposed workaround with the
complement - apart from being ugly - would not have worked.
>
> -
> It is widely used in security settings for multicompany objects, so
> changing the semantic is not advisable.
> - If I understood well, you look for a full containment of the field
> values into the list
> .
>
> Correct.
>
> - Search expressions should convert your requirement to an SQL
> statement, so first you must have a clear view of the generated SQL.
> I've found the following example, I think it covers the requirement:
> http://stackoverflow.com/questions/8425232/sql-select-all-rows-where-subset-exists
>
> This is exactly the situation. I'm now analyzing also another link for
performance considerations:
http://stackoverflow.com/questions/7364969/how-to-filter-sql-results-in-a-has-many-through-relation
>
> - I propose you to extend search clauses to include a 'is contained'
> or 'is not contained" operator leading to an SQL sentence in the way is
> described on the previous link
>
> That's the way to go. should be 'not is contained' to run smoothly
through the operator[4:] statements... I think such a code could easily
cover 4 cases, left is contained in right, right is contained in left and
their corresponding negations. negations probably isn't neceseary as we
have the '!' operator on tuples... well code will show how to do it best.
*Thank you for your guidance!*
References