← Back to team overview

openerp-community team mailing list archive

Re: set context depending on the current record in ir.actions.act_window

 

On Thu, Aug 4, 2011 at 7:39 PM, Fabien Pinckaers <fp@xxxxxxxxxxx> wrote:

>
> > off-topic but related: today the following test [('foo_ids', 'contains',
> > 'bar')] works with a name based on the name_search stuff. However, from
> > my quick tests if I remember properly, it doesn't work with an id such
> > as [('foo_ids', 'contains', id)]. Any chance when an id is provided it
> > would then try to match the id? That would be more precise because names
> > can be duplicated eventually or a name could also be included in some
> > other larger name. What I propose might however conflicts with searching
> > a name containing some number. Any specific syntax we could adopt to
> > have this working? Thoughts?
>
> Raphaël,
>
> Which type of field ? many2one or one2many ? Contains does not exists, I
> think you probably mean 'like' ?
>

Yeah, sorry, meant "ilike". I was asking for one2many and many2many.

>
> For searching on ids, we don't use 'like' but:
>  [('foo_ids', '=', id)]
>  [('foo_ids', 'in', [id,id2])]
> I don't remember having seen/planned some improvements or changes in
> that area.
>

What I sometimes need is the contrary of "in"
so in your example  [('foo_ids', 'in', [id,id2])]$
I want to actually rather test that id is inside the foo_ids collection.
This is kind of possible with "ilike". You can for instance search all
orders having a given product name, but this is not very robust because of
the reasons I gave. I would sometimes need a robust test based on ids and I
think it just makes as much sense.

What do you think?

Thank you for your time.

>
>
> If you propose an improvement, I would suggest to record on
> feedback.openerp.com, our R&D teams does not process every discussions
> on mailing lists. They are used to work on feedback.
>
> --
> Fabien Pinckaers
> CEO OpenERP
> Chaussée de Namur 40
> B-1367 Grand-Rosière
> Belgium
> Phone: +32.81.81.37.00
> Fax: +32.81.73.35.01
> Web: http://openerp.com
>

Follow ups

References