Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
8633 Visualizzazioni

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
Abbandona

Hello you found any solution for this?

Risposta migliore

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
Abbandona

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

Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
mag 19
10343
0
lug 25
312
1
lug 25
5096
0
lug 25
665
0
giu 25
723