This question has been flagged
5873 Views

Hello All,

When i'm calling do_action method from java-script code, i'm not getting action id. Due to this when i'm refreshing or reloading page my form is blank. I'm using Odoo 11.

action_timesheet_user: function(event) {
var self = this;
event.stopPropagation();
event.preventDefault();
alert(self.employee_data.timesheet_action);
if (self.employee_data.uid == 1){
    this.do_action({
name: _t("Timesheets"),
type: 'ir.actions.act_window',
res_model: 'account.analytic.line',
view_mode: 'tree,form',
view_type: 'form',
views: [[false, 'list'],[false, 'form']],
context: {
        //'search_default_employee_id': [self.employee_data.id],
        'search_default_month': true,
        },
target: 'current'
    })}
else {
    this.do_action({
name: _t("Timesheets"),
type: 'ir.actions.act_window',
res_model: 'account.analytic.line',
view_mode: 'tree,form',
view_type: 'form',
views: [[false, 'list'],[false, 'form']],
context: {
        //'search_default_employee_id': [self.employee_data.uid],
        'search_default_month': true,
        },
domain: ['|','|',['user_id', '=', self.employee_data.uid],
['employee_id.department_id.manager_id.user_id', '=', self.employee_data.uid],
['project_id.user_id','in',[self.employee_data.uid]]],
target: 'current'
    },{on_reverse_breadcrumb: function(){ return self.reload();}})}
},

events: _.extend({}, Widget.prototype.events, {'click .custom_helpdesk_tickets': 'action_custom_helpdesk_tickets'}),

XML Template:

<div><a class="btn btn-primary btn-block custom_helpdesk_tickets" role="button"><strong>Helpdesk</strong></a></div>
After calling this function on template button i'm getting:

http://localhost:8069/web?#view_type=list&model=account.analytic.line

Requirement:

http://localhost:8069/web?debug#view_type=list&model=account.analytic.line&menu_id=458&action=487

Thanks in Advance.

Avatar
Discard