Skip to content

Commit 33be2d6

Browse files
committed
Merge PR #1001 into 17.0
Signed-off-by HviorForgeFlow
2 parents b90b7f7 + d9e6f24 commit 33be2d6

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

report_substitute/models/mail_thread.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,27 @@ def message_post_with_source(
1717
**kwargs,
1818
):
1919
template, view = self._get_source_from_ref(source_ref)
20-
old_report_template_ids = False
2120
if template and template.report_template_ids and self.ids:
22-
old_report_template_ids = template.report_template_ids
2321
new_report_template_ids = [
2422
report.get_substitution_report(self.ids).id
2523
for report in template.report_template_ids
2624
]
27-
template.update({"report_template_ids": [(6, 0, new_report_template_ids)]})
28-
res = super().message_post_with_source(
29-
source_ref, render_values, message_type, subtype_xmlid, subtype_id, **kwargs
25+
return super(
26+
MailThread,
27+
self.with_context(default_report_template_ids=new_report_template_ids),
28+
).message_post_with_source(
29+
source_ref,
30+
render_values,
31+
message_type,
32+
subtype_xmlid,
33+
subtype_id,
34+
**kwargs,
35+
)
36+
return super().message_post_with_source(
37+
source_ref,
38+
render_values,
39+
message_type,
40+
subtype_xmlid,
41+
subtype_id,
42+
**kwargs,
3043
)
31-
if old_report_template_ids:
32-
template.report_template_ids = old_report_template_ids
33-
return res

0 commit comments

Comments
 (0)