Skip to Content
Menú
This question has been flagged
2 Respostes
3357 Vistes

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 Best Answer

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
Best Answer

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
Related Posts Respostes Vistes Activitat
4
de febr. 25
2589
1
de gen. 25
1638
1
d’ag. 24
2178
2
de nov. 24
3315
1
de juny 24
1567