[FIX] mail: Fix thread object transfer to chatter in CRM email preview
This commit addresses a problem in CRM where it was not possible to send emails directly from the preview window.
The issue arose when returning to the chatter interface from the preview window,
as the thread object was not properly passed back (to the chatter).
This fix ensures the thread object is reintegrated into the chatter interface, resolving the email sending issue.
Issue was traced back to the commit
5d99de10ec [FIX] mail: do not reload chatter when not needed
https://github.com/odoo/odoo/commit/5d99de10ec09244e10e4130573ad2e0c38e8600
[reproduce]
- install crm
- create activityTypes AT with an email template specified( crm/configuration/activityTypes)
- open a Lead, ( crm/sales/MyPiepline)
- schedule activity with activity type AT
- click "preview" on the activity
- click "send" or just close the preview -> BUG traceback
opw-3680600
closes odoo/odoo#152698
Signed-off-by: Andrzej Pietrusiak (pian) <pian@odoo.com>
This commit is contained in:
@@ -46,8 +46,12 @@ export class ActivityMailTemplate extends Component {
|
||||
force_email: true,
|
||||
},
|
||||
};
|
||||
const thread = this.store.Thread.get({
|
||||
model: this.props.activity.res_model,
|
||||
id: this.props.activity.res_id,
|
||||
});
|
||||
this.env.services.action.doAction(action, {
|
||||
onClose: () => this.props.onUpdate(),
|
||||
onClose: () => this.props.onUpdate(thread),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,10 @@ const views = {
|
||||
<field name="message_ids"/>
|
||||
</div>
|
||||
</form>`,
|
||||
"mail.compose.message,false,form": `
|
||||
<form>
|
||||
<field name="partner_ids"/>
|
||||
</form>`,
|
||||
};
|
||||
|
||||
QUnit.module("activity");
|
||||
@@ -301,6 +305,7 @@ QUnit.test("activity with mail template: preview mail", async (assert) => {
|
||||
assert.strictEqual(action.context.default_template_id, mailTemplateId);
|
||||
assert.strictEqual(action.type, "ir.actions.act_window");
|
||||
assert.strictEqual(action.res_model, "mail.compose.message");
|
||||
return super.doAction(...arguments);
|
||||
},
|
||||
});
|
||||
await contains(".o-mail-Activity");
|
||||
@@ -308,6 +313,8 @@ QUnit.test("activity with mail template: preview mail", async (assert) => {
|
||||
|
||||
await click(".o-mail-ActivityMailTemplate-preview");
|
||||
assert.verifySteps(["do_action"]);
|
||||
await click(".btn-close");
|
||||
await contains(".o-mail-Activity"); // Just to make sure that closing the modal doesn't cause traceback
|
||||
});
|
||||
|
||||
QUnit.test("activity with mail template: send mail", async (assert) => {
|
||||
|
||||
@@ -24,6 +24,7 @@ addModelNamesToFetch([
|
||||
"discuss.channel.rtc.session",
|
||||
"discuss.gif.favorite",
|
||||
"discuss.voice.metadata",
|
||||
"mail.compose.message",
|
||||
"mail.followers",
|
||||
"mail.guest",
|
||||
"mail.link.preview",
|
||||
|
||||
Reference in New Issue
Block a user