xml code:
<header>
<button name="action_prueba" string="prueba" type="object"/>
</header>
js code:
var Widget = require('web.Widget');
class_geofence = Widget.extend({
events: {
"click button[name='action_prueba']": function() {
alert("prueba");
},
},
});
error:
TypeError: this.do_execute_action(...) is undefined
http://localhost:8069/web/content/2102-91fc68e/web.assets_backend.js:469 Rastreo de error: execute_action@http://localhost:8069/web/content/2102-91fc68e/web.assets_backend.js:469:625 proxy/<@http://localhost:8069/web/content/2010-89bd273/web.assets_common.js:3923:11 trigger@http://localhost:8069/web/content/2010-89bd273/web.assets_common.js:3921:180 _trigger_up@http://localhost:8069/web/content/2010-89bd273/web.assets_common.js:3927:365 _trigger_up@http://localhost:8069/web/content/2010-89bd273/web.assets_common.js:3927:449 trigger_up@http://localhost:8069/web/content/2010-89bd273/web.assets_common.js:3927:280 _callButtonAction@http://localhost:8069/web/content/2102-91fc68e/web.assets_backend.js:1328:1694 saveAndExecuteAction/<@http://localhost:8069/web/content/2102-91fc68e/web.assets_backend.js:1431:653 then/</</<@http://localhost:8069/web/content/2010-89bd273/web.assets_common.js:802:681 fire@http://localhost:8069/web/content/2010-89bd273/web.assets_common.js:796:299 add@http://localhost:8069/web/content/2010-89bd273/web.assets_common.js:797:471 then/</<@http://localhost:8069/web/content/2010-89bd273/web.assets_common.js:802:649 each@http://localhost:8069/web/content/2010-89bd273/web.assets_common.js:625:767 then/<@http://localhost:8069/web/content/2010-89bd273/web.assets_common.js:802:560 Deferred@http://localhost:8069/web/content/2010-89bd273/web.assets_common.js:803:194 then@http://localhost:8069/web/content/2010-89bd273/web.assets_common.js:802:525 saveAndExecuteAction@http://localhost:8069/web/content/2102-91fc68e/web.assets_backend.js:1431:577 _onButtonClicked@http://localhost:8069/web/content/2102-91fc68e/web.assets_backend.js:1432:340 proxy/<@http://localhost:8069/web/content/2010-89bd273/web.assets_common.js:3923:11 trigger@http://localhost:8069/web/content/2010-89bd273/web.assets_common.js:3921:180 _trigger_up@http://localhost:8069/web/content/2010-89bd273/web.assets_common.js:3927:365 _trigger_up@http://localhost:8069/web/content/2010-89bd273/web.assets_common.js:3927:449 trigger_up@http://localhost:8069/web/content/2010-89bd273/web.assets_common.js:3927:280 _addOnClickAction/<@http://localhost:8069/web/content/2102-91fc68e/web.assets_backend.js:1390:334 dispatch@http://localhost:8069/web/content/2010-89bd273/web.assets_common.js:892:451 add/elemData.handle@http://localhost:8069/web/content/2010-89bd273/web.assets_common.js:865:173
Check the solution in the below thread:
https://www.odoo.com/es_ES/forum/ayuda-1/question/how-to-customize-the-onclick-javascript-action-of-an-xml-form-button-odoo-11-126024
Hi,
Are you looking to add the button in header near create and edit?