콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
422 화면

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>

아바타
취소