Skip to Content
Menu
This question has been flagged
2 Replies
7329 Views

Hi !
I've searching for 2 days but I don't have results ... I generate a form with HTML in it, and in this html i have a lot of progress bar. The goal is to redirect to the view when clicking on a progress bar. Here my Javascript. 

I can get company and status values, but I'm not able to redirect to the view. I certainly miss something but I don't understand where ...

odoo.define('my_module.dashboard_click', function (require) {
'use strict';

$(document).on('click', '.progress-bar', function(){
var company = $(this).nearest('.company_name').text();
var status = 'Pending';

var action = {
type: 'ir.actions.act_window',
name: 'Reciprocities',
res_model: 'zcnp.rec.reciprocity',
view_type: 'form',
view_mode: 'tree'
}

var self = this;
self.do_action(action);
});

});

The result of that is :


TypeError: self.do_action is not a function
http://localhost:8069/web/content/1870-261c03f/web.assets_backend.js:2951
Traceback:
@http://localhost:8069/web/content/1870-261c03f/web.assets_backend.js:2951:20
dispatch@http://localhost:8069/web/content/1502-5b3f4b8/web.assets_common.js:892:451
add/elemData.handle@http://localhost:8069/web/content/1502-5b3f4b8/web.assets_common.js:865:173

Thanks !


Avatar
Discard

Hello you found any solution for this?

Best Answer

Hello Thomas,


Your code look like perfect, only need to add views and target in the action but please check the self variable value in that method(got properly or not).


try the below code and hope this might help you...


var action = {

            type: 'ir.actions.act_window',

            name: 'Reciprocities',

            res_model: 'zcnp.rec.reciprocity',

            views: [[false, 'form']],

            view_type: 'form',

            view_mode: 'tree',

            target: 'current',

        }




With the help of context in do_action you can pass data in form view

Regards,




Email:      odoo@aktivsoftware.com  

Skype: kalpeshmaheshwari

   

Avatar
Discard

I have the same problem , i did everything like you and i still got no solution for it

Best Answer

you must exit the declaration of the variable self, because this variable does not belong to the onclick function but to that of ODoo, this is why it does not see the do_action function

Avatar
Discard
Related Posts Replies Views Activity
0
May 19
9110
1
Dec 24
132
2
Nov 24
85
1
Oct 24
267
0
Sep 24
213