I have a button named "click" on a form, i want to catch the 'onclick' action in order to run a JS function.
I followed this link so it can work, it did not
https://www.odoo.com/fr_FR/forum/aide-1/question/how-to-customize-the-onclick-javascript-action-of-an-edit-button-odoo-10-125253
here are the errors i got :
web.assets_common.js:3776 warning: Some modules could not be started
Missing dependencies: ["web.form_widgets"]
Non loaded modules: ["upload_multi_attachments.attachs"]
My form code (xml):
<div class="o_row">
<button string="Click" id ="adel" class="o_adel" name="click" type="object" custom="click"/>
<br/>
</div>
My button code (JS) :
odoo.define('upload_multi_attachments.attachs', function (require) {
"use strict";
var Widget = require('web.Widget');
var core = require('web.core');
var _t = core._t;
var QWeb = core.qweb;
var form_widget = require('web.form_widgets');
form_widget.WidgetButton.include({
on_click: function() {
if(this.node.attrs.custom === "click"){
return;
}
this._super();
},
});
});