Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
3337 มุมมอง

Looking for help to hook a button called "Convert to Lead" from my custom form view, on clicking of which should take me to the create lead form and pre-populate the appropriate fields from my custom document into the create lead document and be able to create a new lead.

The background is that I have integrated the CRM telephone call logs to a listview into my Odoo from a 3rd party telephone service, I am trying to implement a feature to convert a selected call log into a lead. 

I am looking for code on the click action of "Convert to Lead" on my call log form view that would pass my values to CRM lead form to be able to create a lead.

Help with this is much appreciated. Thanks!

อวตาร
ละทิ้ง

Thanks, that's exactly what I was looking for.

คำตอบที่ดีที่สุด

Similarly you can redirect to tree view on button click: http://learnopenerp.blogspot.com/2017/10/redirect-to-tree-view-from-button-click.html

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

You can do something like this, on the button click, call a function and from the function, you can return the desired view to display, to get the default values in it, use context.


@api.multi
def function_name(self):
view_id = self.env.ref('id_of_the_form').id
context = {'field_1': self.field_1}
return {
'name': 'A Name',
'view_type': 'form',
'view_mode': 'tree',
'views': [(view_id, 'form')],
'res_model': 'name_of_model_to_display',
'view_id': view_id,
'type': 'ir.actions.act_window',
'target': 'new',
'context': context,
}


Thanks

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ค. 15
4076
0
มี.ค. 15
3146
1
มี.ค. 15
4716
0
มี.ค. 15
3514
0
มี.ค. 25
796