Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
7791 มุมมอง
<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

Related Posts ตอบกลับ มุมมอง กิจกรรม
dynamic domain in one2many แก้ไขแล้ว
2
พ.ค. 24
9209
1
ม.ค. 22
11978
Dynamic Domain in Windows Action แก้ไขแล้ว
1
ก.ค. 20
16024
6
ม.ค. 24
16246
naked domain set up แก้ไขแล้ว
3
ก.ค. 25
4110