Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
2 Antworten
8335 Ansichten

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
Verwerfen

Hello you found any solution for this?

Beste Antwort

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
Verwerfen

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

Beste Antwort

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
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
0
Mai 19
10019
1
Juni 25
439
1
Juni 25
375
1
Mai 25
975
0
März 25
575