コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
3985 ビュー

I have a button with execution in JS. This button works correctly.
but when adding the code, the other buttons stop working

XML Code:

<record id='module_view_form' model='ir.ui.view'>
<field name="name">module.form</field>
<field name="model">module</field>
<field name="arch" type="xml">
<form>
<header>
<button id="action_addpoint" string="Add point" type="action"/>
</header>
</form>
</field>
</record>

JS Code:

odoo.define('module', function(require){
"use strict";
var form_widget = require('web.FormRenderer');
form_widget.include({
_addOnClickAction: function ($el, node)
{
this._super.apply(this, arguments);
$el.click(function ()
{
if(node.attrs.id === "action_addpoint")
{
alert(""prueba);
}
});
},
});
});

Error:

TypeError: this.do_execute_action(...) is undefined

It should only run on JS.

アバター
破棄
著作者

@Ravi Gadnia.

When you add what you indicate, it generates the error

最善の回答

because you don't call super and inheritance broken. add super call like 

var self = this;
this._super.apply(this, arguments);
$el.click(function () ....

アバター
破棄
関連投稿 返信 ビュー 活動
0
4月 24
972
1
3月 15
3864
2
3月 15
9208
2
3月 22
6219
0
3月 15
5166