تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
7850 أدوات العرض
<group>
                            <field name="id" invisible="1"/>
                            <field name="q_versions" widget="selection" on_change="onchange_version(id)" domain="[('sale_id', '=', id)]"/>
                            </group>
                        <group>
                            <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

أفضل إجابة

You can follow this: https://youtu.be/XGqXEL2qQmE 

Hope it helps, Thanks

الصورة الرمزية
إهمال
أفضل إجابة

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

المنشورات ذات الصلة الردود أدوات العرض النشاط
2
مايو 24
9256
1
يناير 22
12014
1
يوليو 20
16092
6
يناير 24
16291
naked domain set up تم الحل
3
يوليو 25
4196