Hello guys, I would like to trigger custom button event from the pos_order detail page.
model action method
def action_custom_button(self):
pass
action button view
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record id="custom_pos_order_form" model="ir.ui.view">
<field name="name">custom.pos.order.form</field>
<field name="model">pos.order</field>
<field name="inherit_id" ref="point_of_sale.view_pos_pos_form" />
<field name="arch" type="xml">
<page name="extra" position="inside">
<button name="action_custom_button" string="Custom Button" type="object" class="oe_highlight" />
</page>
</field>
</record>
</data>
</odoo>
My triggering javascript file is below
/* @odoo-module */
import { patch } from "@web/core/utils/patch";
import { FormController } from "@web/views/form/form_controller";patch(FormController.prototype, {
setup() {
super.setup(...arguments);
console.log('form controller', this);
},
async _onButtonClicked(event) {
if (event.target.name === 'action_custom_button') {
alert('Custom button clicked!');
}
},
});
Please help me where am I wrong?