Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
2696 Lượt xem

Hello,


I am using Odoo 15 and I want to inherit one JS function of the Full composer view to add one more context value.

File path is:

/odoo/addons/mail/static/src/models/composer_view/composer_view.js

Line no. 225, Function name: 

async openFullComposer()
Currently, context inside that is 
const context = {
default_attachment_ids: attachmentIds,
default_body: escapeAndCompactTextContent(this.composer.textInputContent),
default_is_log: this.composer.isLog,
default_model: this.composer.activeThread.model,
default_partner_ids: this.composer.recipients.map(partner => partner.id),
default_res_id: this.composer.activeThread.id,
mail_post_autofollow: true,
};

I want to add one more parameter inside that is:

    'from_full_composer': true

How I can inherit this JS file in my custom module to add one more parameter in context?


Thanks in advance.


Regards,

Hemangi.

Ảnh đại diện
Huỷ bỏ

You are welcome
don't forget to add your file to 'mail.assets_messaging' asset bundle in your addon manifest

Câu trả lời hay nhất

You should redefine the whole method:

import { patchRecordMethods } from '@mail/model/model_core';
patchRecordMethods(
'ComposerView', {async openFullComposer() {/*Your new content*/}}
);

Ảnh đại diện
Huỷ bỏ
Tác giả

Thanks for the explanation. It will help a lot.

@m-azzain I actually want to inherit ComposerView class and add new function like async openFullComposer() .. any help?

@Yagami, It is the same as the above but instead of using patchRecordMethods use addRecordMethods

@Hemangi You are welcome

Thanks @m-azzain, can you please refer any documentation where I can read about the usage of these methods?

@m-azzain, I am unable to find this addRecordMethods method in Odoo source code.

Sorry I missed noticing; you already mentioned 15 in the title

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 8 23
1585
1
thg 6 25
1608
3
thg 7 25
3254
1
thg 5 25
1395
1
thg 5 25
1644