Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
3407 Zobrazení

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
Zrušit
Autor Nejlepší odpověď

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
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
4
úno 25
2703
1
led 25
1677
1
srp 24
2234
2
lis 24
3371
1
čvn 24
1601