要在Odoo11中单击CRM的自定义按钮(更多信息)时要打开管道操作而不是潜在顾客

时间:2018-12-04 07:04:26

标签: javascript action odoo odoo-11

我创建了自定义仪表板,并在该仪表板上添加了自定义按钮。当我单击该按钮(更多信息),然后它使我进入了主菜单,但我想进行管道菜单操作。所以,我该怎么做。

下面是我的代码:

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>

预先感谢

0 个答案:

没有答案