跳至内容
菜单
此问题已终结
584 查看

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?

形象
丢弃
相关帖文 回复 查看 活动
2
12月 24
4755
3
4月 24
6807
3
4月 24
4404
1
1月 24
2746
0
4月 25
79