Así que agregué un botón a una plantilla.
<template id="pay_payment_footer_inherit" name="pay_payment_footer_inherit" inherit_id="website_sale.payment_footer"> <xpath expr="//button[@name='o_payment_submit_button']" position="before"> <button id="pay_direct_checkout" type="button" class="btn btn-primary" data-icon-class="fa-chevron-right"> Pay Now<i class="fa fa-chevron-right"/> </button> </xpath> </template>Ahora, ¿cómo agrego un evento onclick a este botón? estoy usando odoo 15
Lo intenté
odoo.define('my_module.pay_payment_footer_inherit', function (require) { 'use strict'; var Widget = require('web.Widget'); var Checkout = Widget.extend({ events: { 'click #pay_direct_checkout': '_onClick', }, init: function (parent, value) { this._super(parent); }, _onClick: function () { console.log('_onClick') }, }); });En archivo manifiesto .py
'assets': { 'web.assets_frontend': [ 'my_module/static/js/test.js' ] },No funcionó.