# Extending context (or domain) in xml model definition

**URL:** https://discuss.tryton.org/t/extending-context-or-domain-in-xml-model-definition/6332
**Category:** Developer
**Created:** [July 10, 2023, 11:23am UTC](https://discuss.tryton.org/t/extending-context-or-domain-in-xml-model-definition/6332 "2023-07-10T11:23:50Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![maxx](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/maxx/32/2320_2.png) [@maxx](https://discuss.tryton.org/u/maxx)
#### Post date: [July 10, 2023, 11:23am UTC](https://discuss.tryton.org/t/extending-context-or-domain-in-xml-model-definition/6332/1 "2023-07-10T11:23:51Z")

</div>

Hi,

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

```auto
...
        <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) ?

```auto
<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>

```

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [July 10, 2023, 1:58pm UTC](https://discuss.tryton.org/t/extending-context-or-domain-in-xml-model-definition/6332/2 "2023-07-10T13:58:47Z")

</div>

There is no proper way for that.

---

<div class="post-metadata">

### Author: ![maxx](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/maxx/32/2320_2.png) [@maxx](https://discuss.tryton.org/u/maxx)
#### Post date: [July 10, 2023, 2:03pm UTC](https://discuss.tryton.org/t/extending-context-or-domain-in-xml-model-definition/6332/3 "2023-07-10T14:03:35Z")

</div>

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

```auto
<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>

```

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [July 10, 2023, 3:15pm UTC](https://discuss.tryton.org/t/extending-context-or-domain-in-xml-model-definition/6332/4 "2023-07-10T15:15:08Z")

</div>

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