Skip to Content
Menu
This question has been flagged
2 Replies
3292 Views

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
Discard
Author 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
Discard
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
Discard
Related Posts Replies Views Activity
4
Feb 25
2346
1
Jan 25
1509
1
Aug 24
1979
2
Nov 24
3168
1
Jun 24
1485