Odoo Help


use dynamic value in domain

on 5/15/13, 11:24 PM 1,994 views
                            <field name="id" invisible="1"/>
                            <field name="q_versions" widget="selection" on_change="onchange_version(id)" domain="[('sale_id', '=', id)]"/>
                            <button name="add_version" string="add version" type="object" class="oe_edit_only" />

there is a error, that id is not defined. how can i use dynamic domain

I am also facing the same problem...

Note: we can define domain="[('sale_id', '=', id)]" only in py file

when widget="selection" is used in xml, the domain provided in python file gets overridden

Atchuthan - Technical Consultant, Sodexis Inc
on 11/26/13, 1:41 AM
Sudhir Arya (SA)
On 5/16/13, 3:22 AM

You cannot use field id because id field is automatically generated by orm of OpenERP.

You can use active_id or active_ids which indicates your current active records.

Try this:

domain="[('sale_id', '=', active_id)]"

active_id alse show 'active_id' not defined
there is no active_id in my context

on 5/16/13, 4:46 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 5/15/13, 11:24 PM
Seen: 1994 times
Last updated: 3/16/15, 8:10 AM