콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
8637 화면

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 !


아바타
취소

Hello you found any solution for this?

베스트 답변

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

   

아바타
취소

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

베스트 답변

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

아바타
취소
관련 게시물 답글 화면 활동
0
5월 19
10343
0
7월 25
312
1
7월 25
5096
0
7월 25
665
0
6월 25
723