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

Hello, i have created a module in which i created a new form view for "product.product" and added some fields to it.

While testing using the odoo tests common Form object, it uses the original odoo form view and it can't access those fields since they are not a part of the view it's using.

My question is: 

how do i force the Form object to work on a specific form view?

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

Hello again, i found a way to do it, i should refer to the form id when creating a Form object with the key "view" 

Example : product_form = Form(self.env['product.product'], view='module_name.view_id') 





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

Hi Youcef,


If you've multiple form views of the same model, then you should create a new window action and then you can link you desired view with the action.

Below is the example to attach a view with the action:


       id="action_crm_send_mass_convert"
       name="Convert to opportunities"
       res_model="crm.lead2opportunity.partner.mass"
       binding_model="crm.lead" binding_views="list"
       view_mode="form" target="new"
       context="{'mass_convert' : True}"
      view_id="view_crm_lead2opportunity_partner_mass"
      groups="sales_team.group_sale_salesman"
/>

Ả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 21
2506
3
thg 9 24
4313
2
thg 8 24
2692
2
thg 2 24
1602
2
thg 9 23
9973