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

 I want to customize the onclick Javascript action for the form of the model stock.picking. What is the easiest way to do this

아바타
취소
베스트 답변

Hello Jan, 

Add code in your js file 

/**window.alert("Page is Reload");**/
odoo.define('Module.js file name', function (require) {
"use strict";
var form_widget = require('web.form_widgets');
var core = require('web.core');
var _t = core._t;
var QWeb = core.qweb;
form_widget.WidgetButton.include({
    on_click: function() {
         if(this.node.attrs.custom === "click"){
            //code //
         return;
         }
         this._super();
    },
});
});

and define into your xml file : 

<button name="java_script" string="Java Script" type="object" custom="click"/>

There java_script is my function name which one define in .py file.

I hope it's help you

Thanks 

아바타
취소
베스트 답변

How can i accomplish this on Version 12 .

Somehow the module web.form_widgets does not exist in this version.

Thanks in advance.

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