Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
7798 Lượt xem
<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

Ảnh đại diện
Huỷ bỏ

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

Câu trả lời hay nhất

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

Hope it helps, Thanks

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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)]"
Ảnh đại diện
Huỷ bỏ
Tác giả

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 5 24
9220
1
thg 1 22
11981
1
thg 7 20
16029
6
thg 1 24
16252
naked domain set up Đã xử lý
3
thg 7 25
4117