Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
3393 Widoki

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>

Awatar
Odrzuć
Autor Najlepsza odpowiedź

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.

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
4
lut 25
2663
1
sty 25
1660
1
sie 24
2226
2
lis 24
3357
1
cze 24
1591