El dia 23/09/2015 1.15, "Cédric Krier" <[email protected]> va escriure:
>
> On 2015-09-23 00:51, Raimon Esteve wrote:
> > Hie,
> >
> > I try to do an ir.rule with a domain to Eval context value.
> >
> >         <record model="ir.rule" id="rule_sale1">
> >             <field name="domain"
> >                 eval="[('shop', '=', Eval('context', {}).get('shop',
-1))]"
> >                 pyson="1"/>
> >             <field name="rule_group" ref="rule_group_sale"/>
> >         </record>
> >
> > After update module, PYSON is converted to:
> >
> > [["shop", "=", {"d": -1, "k": "shop", "__class__": "Get", "v": {"d":
> > {}, "__class__": "Eval", "v": "context"}}]]
> >
> > When I try to acces sale doesn't get shop from the context.
>
> Maybe it is not in the context.

I have "shop" in context.

> > If I try with user, in this case work successfully.
> >
> >             <field name="domain"
> >                 eval="[('shop', '=', Eval('user', {}).get('shop', -1))]"
> >                 pyson="1"/>
> >
> > What are I missing? Is it possible ir.rule with context?
>
> I don't know but I will never ever do such thing. You don't base
> security on contextual value that user can set.

Sometimes we need to change "user" and "shop" in some tasks. I try change
ir.rule with "shops" user, not "shop" user.

Thanks.

Reply via email to