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

Hello,

When you are on a partner form and click on the sales button, you arrive on a list of his sales.
And if we click on the create button, we arrive on the order form and the customer is already selected by default.
How to do that, pass a context (here the partner) from the list to the form when click on create button ?

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

Finally found the solution
I just add the context when the ir.actions.act_window is called

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

Hi, can you post the code of the solution, please?

Câu trả lời hay nhất
When call 'ir.actions.act_window' action that time add a context field

{'default_type': 'to_approve', 'search_default_to_approve':1}

you can use this way. For default value set: 'default_your_field', For default search: search_default_your_field
Ảnh đại diện
Huỷ bỏ

<record id="open_wage_increment" model="ir.actions.act_window">
<field name="name">Individual</field>
<field name="res_model">hr.contract.wage.increment</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_hr_wage_increment_filter" />
<field name="context">{'default_type': 'to_approve', 'search_default_to_approve':1}</field>
</record>