Skip to Content
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
302 Представления

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.

Аватар
Отменить
Лучший ответ

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>

Аватар
Отменить