details: https://code.tryton.org/tryton/commit/c17fc6f55afe
branch: 7.0
user: Adrià Tarroja Caubet <[email protected]>
date: Sat Jun 06 11:47:25 2026 +0200
description:
Use current record context when rendering email templates
Pass the current record context from the email dialog when fetching
template values and defaults. This keeps context-dependent models,
including table_query records, addressable after the user changes the
context.
Closes #14565
(grafted from 868b0e31fbdecc0e04b2cb1c894829c5eba19fa4)
diffstat:
sao/src/window.js | 5 +++--
tryton/tryton/gui/window/email_.py | 6 ++++--
2 files changed, 7 insertions(+), 4 deletions(-)
diffs (44 lines):
diff -r ab133238aaa9 -r c17fc6f55afe sao/src/window.js
--- a/sao/src/window.js Sun May 24 08:31:26 2026 -0700
+++ b/sao/src/window.js Sat Jun 06 11:47:25 2026 +0200
@@ -2529,15 +2529,16 @@
},
_fill_with: function(template) {
var prm;
+ let context = this.record.get_context();
if (template) {
prm = Sao.rpc({
'method': 'model.ir.email.template.get',
- 'params': [template, this.record.id, {}],
+ 'params': [template, this.record.id, context],
}, this.record.model.session);
} else {
prm = Sao.rpc({
'method': 'model.ir.email.template.get_default',
- 'params': [this.record.model.name, this.record.id, {}],
+ 'params': [this.record.model.name, this.record.id,
context],
}, this.record.model.session);
}
prm.then(values => {
diff -r ab133238aaa9 -r c17fc6f55afe tryton/tryton/gui/window/email_.py
--- a/tryton/tryton/gui/window/email_.py Sun May 24 08:31:26 2026 -0700
+++ b/tryton/tryton/gui/window/email_.py Sat Jun 06 11:47:25 2026 +0200
@@ -291,14 +291,16 @@
def _fill_with(self, template=None):
try:
+ context = self.record.get_context()
if template:
values = RPCExecute(
'model', 'ir.email.template', 'get',
- template, self.record.id)
+ template, self.record.id, context=context)
else:
values = RPCExecute(
'model', 'ir.email.template', 'get_default',
- self.record.model_name, self.record.id)
+ self.record.model_name, self.record.id,
+ context=context)
except RPCException:
return
self.to.set_text(', '.join(values.get('to', [])))