Extending context (or domain) in xml model definition

Hi,

I need to extend a context in xml file with a custom module:

...
        <record model="ir.action.act_window" id="act_products_by_locations_relate">
            <field name="name">Products by Locations</field>
            <field name="res_model">stock.products_by_locations</field>
            <field name="context" eval="{'locations': Eval('active_ids')}" pyson="1"/>
            <field name="domain"
                eval="['OR', ('quantity', '!=', 0.0), ('forecast_quantity', '!=', 0.0)]"
                pyson="1"/>
            <field name="search_value"
                eval="[('consumable', '=', False)]"
                pyson="1"/>
            <field name="context_model">stock.products_by_locations.context</field>
        </record>
...

Should I just do this (rewriting the whole context) ?

<record model="ir.action.act_window" id="stock.act_products_by_locations_relate">
    <field name="context" eval="{'locations': Eval('active_ids'), 'with_childs': True}" pyson="1"/>
</record>
1 Like

There is no proper way for that.

So doing this will work ? (will the model be still ok and the context updated?)

<record model="ir.action.act_window" id="stock.act_products_by_locations_relate">
    <field name="context" eval="{'locations': Eval('active_ids'), 'with_childs': True}" pyson="1"/>
</record>

Yes but it may be updated twice on each update or you will have warnings.