Odoo Help


How to customize the onclick Javascript action of an "Edit" button (Odoo 10)

Jan Schlenker
on 10/22/17, 9:21 AM 924 views

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

Manish Bohra
On 10/23/17, 12:43 AM

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;
    on_click: function() {
         if(this.node.attrs.custom === "click"){
            //code //

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


About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 10/22/17, 9:21 AM
Seen: 924 times
Last updated: 10/23/17, 12:43 AM