콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
7247 화면

I need to inherit a js funtion in mail module. Here's the file path  of the file that I want to inherit : mail\static\src\models\activity\activity.js

The function I want to inherit is 

async markAsDone({ attachments = [], feedback = false }) {
const attachmentIds = attachments.map(attachment => attachment.id);
await this.async(() => this.env.services.rpc({
model: 'mail.activity',
method: 'action_feedback',
args: [[this.id]],
kwargs: {
attachment_ids: attachmentIds,
feedback,
},
}));
this.thread.refresh();
this.delete();
}

I want to add location.reload(); before this.delete();
The reason for this is that I want to update screen after an attachment is uploaded.

Thanks.

아바타
취소
베스트 답변

Hi,

Try to inherit function like below.

odoo.define( YOUR odoo.define PATH, function (require) {
'use strict';
const {
registerInstancePatchModel,
registerFieldPatchModel,
} = require('mail/static/src/model/model_core.js');
const { attr, one2one } = require('mail/static/src/model/model_field.js');
registerInstancePatchModel('mail.activity', YOUR odoo.define PATH, {
async markAsDone ({attachments = [], feedback = false }) {
const attachmentIds = attachments.map (attachment => attachment.id);
await this .async (() => this .env.services.rpc ({
model: 'mail.activity' ,
method: 'action_feedback' ,
args: [[ this .id]],
kwargs: {
attachment_ids: attachmentIds,
feedback ,
},
}));
           this.thread.refresh ();
           location.reload();
           this.delete();
}
});
});

Regards

아바타
취소
작성자

Thanks @cybrosis

관련 게시물 답글 화면 활동
0
5월 22
656
2
12월 16
5592
1
4월 15
4711
0
10월 24
1250
1
6월 20
3706