Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
6 Trả lời
17263 Lượt xem

Hi,
I need to migrate module from Odoo 8 to Odoo 11. I have some problem with some model in XML code, in Odoo 8 we can use ir.values and this model have field named "value" which can be filled with some actions (e.g:  ir.actions.server + str(ref(action_id_from_ir_actions_server))). But in Odoo 11 I cannot find any similar model with this ir.values, I have try to read documentation but I cannot find what I need. Any idea for this ir.values in Odoo 11?

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

in Odoo v11 , ir.values is replaced by ir.defaults and two extra fields in actions ,

*binding_type

*binding_model_id

Tác giả

Hi Niyas, yes I have try used binding_model_id but I think it used to reference some model and how can I do this ir.actions.server + str(ref(action_id_from_ir_actions_server))? How about ir.actions.todo model? Can I use this model?

Tác giả Câu trả lời hay nhất

HI,
after few days struggling with ir.values problem (since it not exist in Odoo 11), my friend and I have found some solution.

we can use ir.actions.server model and fill binding_model_id field with your target model where that menu want to be added (e.g if you want to place some action menu in purchase.order model so you just fill binding_model_id with purchase.order model. And for code field which is usually we use it for calling python function we fill with "model.your_python_function()"

for more clear answer to sample code is like this :

================ XML File ================
<record id="action_server_learn_skill" model="ir.actions.server">
<field name="name">Learning</field>
<field name="type">ir.actions.server</field>
<field name="model_id" ref="your_module_folder_name.model_your_model" />
<field name="binding_model_id" ref="module_folder_name.model_your_target_model" />
<field name="state">code</field>
<field name="code">model.action_learn()</field>
</record>

Hope my solution will give you a little help :)    

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

In Odoo 11.0, ir.values is replace by binding_model_id in ir_actions 

in your ir_actions xml file, binding_model_id field like this

    <field name="binding_model_id" ref="module_folder_name.model_your_target_model" />
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất


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


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 9 19
5231
4
thg 11 18
6077
2
thg 2 24
3391
1
thg 8 23
4952
2
thg 12 22
6445