Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
276 Zobrazení

Hello Odoo Community,

I am working with Odoo 18 and trying to customize the Website Menu Editor. Specifically, I want to add an extra field (e.g., an Image widget ) inside the “Add a Menu Item” dialog box that opens when editing menus in the website backend.

Avatar
Zrušit
Nejlepší odpověď

Hii,

To override the Website Menu Editor dialog in Odoo 18 without modifying core addons, you need to extend the existing Owl components used in the website menu editor through a custom module.
Here js file,
/** @odoo-module **/

import { patch } from "@web/core/utils/patch";

import { MenuDialog } from "@website/js/menu/menu_dialog"; // Adjust if path changes


patch(MenuDialog.prototype, {

    setup() {

        this._super();

        this.state.extraImage = null;  // Custom field state

    },


    async saveMenuItem() {

        // Add your custom logic here (e.g., save extraImage)

        console.log("Saving image:", this.state.extraImage);

        await this._super();

    },

});

assets.xml
<odoo>

  <template id="assets_frontend" inherit_id="web.assets_frontend" name="Custom Menu Dialog Patch">

    <xpath expr="." position="inside">

      <script type="module" src="/your_module/static/src/js/menu_dialog_patch.js"/>

    </xpath>

  </template>

</odoo>

Avatar
Zrušit