admin管理员组

文章数量:1203458

I try to add a cogmenu that set my record to a soft deleted state.

My action is working correctly, but the view is not updated. how can I update my view ?

This is my current code. I force the reload since the form is not updated

export class CogMenuItemTrash extends Component {
    static template = "CogMenuItemTrash";
    static components = { DropdownItem };
    static props = {};

    setup() {
        this.action = useService("action");
        this.orm = useService("orm");
    }

    onTrash() {
        const controller = this.action.currentController;
        const currentId = controller.currentId || controller.props.resId;
        this.orm.call('model', 'action_send_to_trash', [currentId])
        this.action.doAction({
            type: "ir.actions.client",
            tag: "reload",
        });
    }
}

When I add this action to the view.xml it's correctly refreshed. I would like that my cogaction act like any others actions of the form view.

本文标签: odooAdding action on cogmenuStack Overflow