Hello All,
I created custom dashboard and added custom button on that dashboard. And when i click on that button(More Info) then then it landed me to lead menu but i want to Pipeline menu action. So, how i do that.
Below is my code:
Python :
@api.model
def get_employee_info(self):
uid = request.session.uid
custom_crm_lead_view_id = self.env['crm.lead'].sudo().search_count([('type', '=', 'opportunity')])
employee_id = self.env['res.users'].sudo().search_read([], limit=1)
custom_crm_lead_search_view_id = self.env.ref('crm.view_crm_case_opportunities_filter')
if employee_id:
data = {
'uid': uid,
'custom_crm_lead_view_id': custom_crm_lead_view_id,
'custom_crm_lead_search_view_id': custom_crm_lead_search_view_id.id,
}
employee_id[0].update(data)
return employee_id
Js :
action_custom_crm_lead: function(event) {var self = this;
event.stopPropagation();
event.preventDefault();
this.do_action({
name: _t("CRM LEAD"),
type: 'ir.actions.act_window',
res_model: 'crm.lead',
view_mode: 'tree,form',
view_type: 'form',
views: [[false, 'list'],[false, 'form']],
domain: [['type','=','opportunity']],
search_view_id: self.employee_data.custom_crm_lead_search_view_id,
target: 'current'
},{on_reverse_breadcrumb: function(){ return self.reload();}})
Xml:
<div><div class="dash-box dash-box-color-2">
<div class="dash-box-icon">
<i class="fa fa-clock-o"></i>
</div>
<div class="dash-box-body">
<span class="dash-box-count"><t t-esc="widget.employee_data.custom_crm_lead_view_id"/></span>
<span class="dash-box-title">Lead</span>
</div>
<div class="dash-box-action custom_crm_lead">
<button>More Info</button>
</div>
</div>
</div>
Thanks in advance