Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

223
Views
Add js onclick to a button in an inherit template Odoo 15

So I added a button to a template.

<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>

Now how do I add an onclick event to this button? I'm using odoo 15

I tried

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')
        },
    });
});

In file manifest.py

'assets': {
    'web.assets_frontend': [
        'my_module/static/js/test.js'
    ]
},

It did not work.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!