Odoo javascript onclick event - Stack Overflow

Is it possible create my own button and this button click call javascript function? Like simple onclick

Is it possible create my own button and this button click call javascript function? Like simple onclick javascript method?

If the answer is yes, how can I do that?

I want to use "Add an item" button or create my own button that calls the same function like I click on "Add an item" button.

Is it possible create my own button and this button click call javascript function? Like simple onclick javascript method?

If the answer is yes, how can I do that?

I want to use "Add an item" button or create my own button that calls the same function like I click on "Add an item" button.

Share Improve this question asked Aug 7, 2017 at 20:15 fueggitfueggit 1,0433 gold badges25 silver badges50 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

First Create button where ever you want to create with some modifications.

<button string="Click" custom="click"/>

Then create one JS file that will contain following code.

odoo.define('YOUR_MODULE.FILENAME', 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"){

            // YOUR CODE

            return;
         }
         this._super();
    },
});
});

i have posed this type of question, i got this solution this answer working partially. please refer this link how to write events for formview inside header buttons? odoo 10

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744963235a4603514.html

相关推荐

  • Odoo javascript onclick event - Stack Overflow

    Is it possible create my own button and this button click call javascript function? Like simple onclick

    1天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信