Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
3284 Vistas

Hello all,  please tell me where is mistake. i'm not get any error, console.log in .js is working, but i don't see any changes in template view


js

/** @odoo-module **/

import {    registerInstancePatchModel,    registerFieldPatchModel,} from"@mail/model/model_core";import { attr } from"@mail/model/model_field";


registerInstancePatchModel"mail.discuss_sidebar_category_item",    "sync_telegram/static/src/components/discuss_sidebar/discuss_sidebar_category_item.js",    {        

​/**         

​* @private         

​* @returns{boolean}         

​*/        

​_computeIsTelegramChannel() {            console.log('_computeIsTelegramChannel===============');            return this.channelType === "multi_livechat_telegram";        

​},

 });


registerFieldPatchModel(    "mail.discuss_sidebar_category_item",    "sync_telegram/static/src/components/discuss_sidebar/discuss_sidebar_category_item.js",    {        isTelegramChannel:attr({            compute:"_computeIsTelegramChannel",        }),  

});


xml


xml version="1.0" encoding="UTF-8"?><templatesxml:space="preserve">

<t-inherit="mail.DiscussSidebarCategoryItem"t-inherit-mode="extension">        <xpath expr="//t[@t-if='categoryItem.hasSettingsCommand']"position="after">                 <span>Some textspan>

<t-if="categoryItem.isTelegramChannel">                <div class="o_DiscussSidebarCategoryItem_command o_DiscussSidebarCategoryItem_commandSettings fa fa-tree"t-on-click="categoryItem.onClickCommandSettings" title="Channel settings"role="img"/>t>

xpath>

t>

templates>

Avatar
Descartar
Autor Mejor respuesta

Cybrosys Techno Solutions Pvt.Ltd, Thanks! Can't answer without rating, so i'll writу here. The problem is that following this example, like many others on the web, I am faced with the inability to import a class because it is not exported initially. That's why I'm looking for options - how I can expand this class. Sо this is odoo 15, the standard module "mail", you can find this class - odoo15/addons/mail/static/src/models/discuss_sidebar_category_item/discuss_sidebar_category_item.js - I'm looking for a way to extend the functionality of the DiscussSidebarCategoryItem class.

Avatar
Descartar
Mejor respuesta

Hi,

Please refer to this blog to understand how to patch owl templates in odoo 16.

https://www.cybrosys.com/blog/how-to-patch-existing-owl-component-in-odoo-16

Regards

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
4
feb 25
2329
1
ene 25
1500
1
ago 24
1972
2
nov 24
3149
1
jun 24
1475