تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
13845 أدوات العرض

 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
مارس 17
8386
0
يونيو 25
313
1
يونيو 25
626
1
يونيو 25
619
1
مايو 25
1188