← Back to team overview

openerp-community team mailing list archive

Re: how to define an eval'd domain?

 

That's strange, from my PoV it should work...

2011/9/14 Viktor Nagy <viktor.nagy@xxxxxxxxxxx>

> hi,
>
> I have some custom product views where I would like to restrict the shown
> categories using a domain attribute. The categories to be restricted for are
> defined in xml, thus using ref and eval would do the work. But the following
> does not work
>
>         <record id="view_consumable_inherit_form" model="ir.ui.view">
>             <field name="name">product.consumable.inherit</field>
>             <field name="model">product.product</field>
>             <field name="inherit_id" ref="view_consumable_form"/>
>             <field name="type">form</field>
>             <field name="arch" type="xml">
>                 <data>
>                     <xpath expr="//field[@name='categ_id']"
> position="attributes">
>                         <attribute name="domain">[('parent_id',
> '=',ref('product_category_consumable'))]</attribute>
>                     </xpath>
>                 </data>
>             </field>
>         </record>
>
> neither does
>
>                         <attribute name="domain" eval="'[(\'parent_id\',
> \'=\','+str(ref('product_category_consumable'))+')]'"/>
>
> with the latter the error is:
> [2011-09-14 08:41:20,186][aperam]
> ERROR:init:<string>:3:0:ERROR:RELAXNGV:RELAXNG_ERR_NOELEM: Expecting an
> element , got nothing
> [2011-09-14 08:41:20,186][aperam]
> ERROR:init:<string>:3:0:ERROR:RELAXNGV:RELAXNG_ERR_INVALIDATTR: Invalid
> attribute position for element xpath
>
> so how do you add such a constraint to your views?
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-community
> Post to     : openerp-community@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openerp-community
> More help   : https://help.launchpad.net/ListHelp
>
>

References