Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Redner Odoo Module
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XCG
Odoo modules
Redner Odoo Module
Commits
12f80aca0e9e
Commit
12f80aca0e9e
authored
5 months ago
by
Axel Prel
Browse files
Options
Downloads
Patches
Plain Diff
add expression builder to mail template substitutions
parent
c27fcb55ca46
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!67
Implement caching and optimization for Redner template handling
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
models/redner_substitution.py
+37
-0
37 additions, 0 deletions
models/redner_substitution.py
views/mail_template.xml
+22
-0
22 additions, 0 deletions
views/mail_template.xml
with
59 additions
and
0 deletions
models/redner_substitution.py
+
37
−
0
View file @
12f80aca
...
...
@@ -119,3 +119,40 @@
d
[
sub
.
keyword
.
rsplit
(
"
.
"
,
2
)[
-
1
]]
=
conv
return
converter
.
Model
(
""
,
d
)
def
action_build_expression
(
self
):
if
not
(
self
and
self
.
ir_actions_report_id
):
if
not
self
.
template_id
:
# neither a report nor a mail template
return
else
:
model
=
self
.
env
.
get
(
self
.
template_id
.
model_id
.
model
)
else
:
model
=
self
.
env
.
get
(
self
.
ir_actions_report_id
.
model
)
if
model
is
None
:
return
# reset the older substitution value
self
.
value
=
""
wizard
=
self
.
env
[
"
expression.builder.wizard
"
].
create
(
{
"
substitution_id
"
:
self
.
id
,
"
expression
"
:
""
,
}
)
vals_list
=
wizard
.
get_fields
(
model
,
self
.
converter
)
for
val
in
vals_list
:
val
[
"
wizard_id
"
]
=
wizard
.
id
fields_list
=
self
.
env
[
"
expression.builder.field
"
].
create
(
vals_list
)
wizard
.
suggested_fields
=
[(
6
,
0
,
fields_list
.
ids
)]
return
{
"
type
"
:
"
ir.actions.act_window
"
,
"
res_model
"
:
"
expression.builder.wizard
"
,
"
view_mode
"
:
"
form
"
,
"
res_id
"
:
wizard
.
id
,
"
target
"
:
"
new
"
,
}
This diff is collapsed.
Click to expand it.
views/mail_template.xml
+
22
−
0
View file @
12f80aca
...
...
@@ -40,6 +40,28 @@
<field
name=
"keyword"
/>
<field
name=
"converter"
/>
<field
name=
"value"
/>
<button
name=
"action_build_expression"
type=
"object"
string=
"Build expression"
class=
"oe_highlight"
invisible=
"not (value and value!='') or not (converter and converter in ['field','relation-to-many'])"
confirm=
"This will delete the current substitution value. Continue anyway ?"
/>
<button
name=
"action_build_expression"
type=
"object"
string=
"Build expression"
class=
"oe_highlight"
invisible=
"(value and value !='') or not (converter and converter in ['field','relation-to-many'])"
/>
<button
name=
"action_build_expression"
type=
"object"
string=
"Build expression"
class=
"oe_highlight disabled"
invisible=
"converter in ['field','relation-to-many']"
/>
</list>
</field>
</group>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment