Skip to content

Commit 86853e0

Browse files
[MIG] mail_layout_force: Migration to 18.0
1 parent 131def9 commit 86853e0

File tree

10 files changed

+85
-106
lines changed

10 files changed

+85
-106
lines changed

mail_layout_force/README.rst

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ body when sending an email. It usually displays the related document
3535
reference, the company logo, and a small footer saying "Powered by
3636
Odoo".
3737

38-
There are notably two main layouts used in Odoo, and the user can't
38+
There are notably three main layouts used in Odoo, and the user can't
3939
control when they're used, as it's hardcoded into the different
4040
applications.
4141

42-
- ``mail.message_notification_email``
42+
- ``mail.mail_notification_layout``
43+
- ``mail.mail_notification_layout_with_responsible_signature``
4344
- ``mail.mail_notification_light``
44-
- ``mail.mail_notification_paynow``
4545

4646
This module allows to force a specific layout for a given
47-
``email.template``, effectively overwritting the one hardcoded by Odoo.
47+
``email.template``, effectively overwriting the one hardcoded by Odoo.
4848
Additionally, it enables forcing a custom layout for emails that do not
4949
use an existing ``email.template`` record (e.g., when sending an email
5050
from the chatter).
@@ -60,9 +60,11 @@ sent to your customers.
6060
Configuration
6161
=============
6262

63-
# Go to Configuration > Technical > Emails > Templates # Open the
64-
desired ``email.template`` record. # In Advanced Parameters tab, find
65-
the Force Layout field.
63+
To configure a forced layout for email templates:
64+
65+
1. Go to *Settings > Technical > Email > Email Templates*
66+
2. Open the desired ``email.template`` record
67+
3. In the *Settings* tab, find the *Force Layout* field
6668

6769
You can leave it empty to use the default email layout (chosen by Odoo).
6870
You can force a custom email layout of your own. You can use the *Mail:
@@ -72,20 +74,26 @@ To configure a custom layout of your own, some technical knowledge is
7274
needed. You can see how the existing layouts are defined for details or
7375
inspiration:
7476

77+
- ``mail.mail_notification_layout``
78+
- ``mail.mail_notification_layout_with_responsible_signature``
7579
- ``mail.mail_notification_light``
76-
- ``mail.mail_notification_paynow``
77-
- ``mail.mail_notification_borders``
78-
79-
To force a new custom layout for emails that do not use an existing
80-
``email.template`` record (e.g., emails sent from the chatter):
81-
82-
#. Go to Settings > Technical > User Interface > Views. #. Copy the
83-
current layout (e.g., mail.message_notification_email) to create a new
84-
one, and remove any parts you don’t need. #. Open the layout that you
85-
want to swap with a substitute. Then, under the Layout Mapping tab: \*
86-
Set ``Substitute Layout`` to the new custom layout you created. \* Set
87-
``Models`` if you want to apply the replacement only to specific models.
88-
If left empty, the email layout will be replaced for all models.
80+
81+
To force a custom layout for emails that do not use an existing
82+
``email.template`` record (e.g., emails sent from the chatter), you can
83+
use the Layout Mapping feature:
84+
85+
1. Go to *Settings > Technical > User Interface > Views*
86+
2. Copy the current layout (e.g.,
87+
``mail.mail_notification_layout_with_responsible_signature``) to
88+
create a new custom layout, and customize it as needed
89+
3. Open the original layout view that you want to replace. Under the
90+
*Layout Mapping* tab:
91+
92+
- Click *Add a line*
93+
- Set *Substitute Layout* to the new custom layout you created
94+
- Set *Models* if you want to apply the replacement only to specific
95+
models. If left empty, the email layout will be replaced for all
96+
models
8997

9098
Bug Tracker
9199
===========

mail_layout_force/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{
66
"name": "Mail Layout Force",
77
"summary": "Force a mail layout on selected email templates",
8-
"version": "17.0.1.0.1",
8+
"version": "18.0.1.0.0",
99
"author": "Camptocamp, Odoo Community Association (OCA)",
1010
"maintainers": ["ivantodorovich"],
1111
"website": "https://github.com/OCA/mail",

mail_layout_force/migrations/17.0.1.0.1/pre-migration.py

Lines changed: 0 additions & 44 deletions
This file was deleted.

mail_layout_force/models/mail_thread.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ def _notify_thread_by_email(
1717
model_description=False,
1818
force_email_company=False,
1919
force_email_lang=False,
20+
subtitles=None,
2021
resend_existing=False,
2122
force_send=True,
2223
send_after_commit=True,
23-
subtitles=None,
2424
**kwargs,
2525
):
2626
msg_vals = msg_vals or {}
@@ -56,9 +56,9 @@ def _notify_thread_by_email(
5656
model_description=model_description,
5757
force_email_company=force_email_company,
5858
force_email_lang=force_email_lang,
59+
subtitles=subtitles,
5960
resend_existing=resend_existing,
6061
force_send=force_send,
6162
send_after_commit=send_after_commit,
62-
subtitles=subtitles,
6363
**kwargs,
6464
)
Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
\# Go to Configuration \> Technical \> Emails \> Templates \# Open the
2-
desired `email.template` record. \# In Advanced Parameters tab, find the
3-
Force Layout field.
1+
To configure a forced layout for email templates:
2+
3+
1. Go to *Settings > Technical > Email > Email Templates*
4+
2. Open the desired `email.template` record
5+
3. In the *Settings* tab, find the *Force Layout* field
46

57
You can leave it empty to use the default email layout (chosen by Odoo).
68
You can force a custom email layout of your own. You can use the *Mail:
@@ -10,16 +12,17 @@ To configure a custom layout of your own, some technical knowledge is
1012
needed. You can see how the existing layouts are defined for details or
1113
inspiration:
1214

15+
- `mail.mail_notification_layout`
16+
- `mail.mail_notification_layout_with_responsible_signature`
1317
- `mail.mail_notification_light`
14-
- `mail.mail_notification_paynow`
15-
- `mail.mail_notification_borders`
1618

17-
To force a new custom layout for emails that do not use an existing ``email.template``
18-
record (e.g., emails sent from the chatter):
19+
To force a custom layout for emails that do not use an existing `email.template`
20+
record (e.g., emails sent from the chatter), you can use the Layout Mapping feature:
1921

20-
#. Go to Settings > Technical > User Interface > Views.
21-
#. Copy the current layout (e.g., mail.message_notification_email) to create a new one, and remove any parts you don’t need.
22-
#. Open the layout that you want to swap with a substitute. Then, under the Layout Mapping tab:
23-
* Set ``Substitute Layout`` to the new custom layout you created.
24-
* Set ``Models`` if you want to apply the replacement only to specific models. If left empty,
25-
the email layout will be replaced for all models.
22+
1. Go to *Settings > Technical > User Interface > Views*
23+
2. Copy the current layout (e.g., `mail.mail_notification_layout_with_responsible_signature`) to create a new custom layout, and customize it as needed
24+
3. Open the original layout view that you want to replace. Under the *Layout Mapping* tab:
25+
* Click *Add a line*
26+
* Set *Substitute Layout* to the new custom layout you created
27+
* Set *Models* if you want to apply the replacement only to specific models. If left empty,
28+
the email layout will be replaced for all models

mail_layout_force/readme/DESCRIPTION.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ The email layout is a ``QWeb`` view that ends up wrapping the message body
44
when sending an email. It usually displays the related document reference,
55
the company logo, and a small footer saying "Powered by Odoo".
66

7-
There are notably two main layouts used in Odoo, and the user can't control when
7+
There are notably three main layouts used in Odoo, and the user can't control when
88
they're used, as it's hardcoded into the different applications.
99

10-
* ``mail.message_notification_email``
10+
* ``mail.mail_notification_layout``
11+
* ``mail.mail_notification_layout_with_responsible_signature``
1112
* ``mail.mail_notification_light``
12-
* ``mail.mail_notification_paynow``
1313

1414
This module allows to force a specific layout for a given ``email.template``,
15-
effectively overwritting the one hardcoded by Odoo. Additionally, it enables
15+
effectively overwriting the one hardcoded by Odoo. Additionally, it enables
1616
forcing a custom layout for emails that do not use an existing ``email.template``
1717
record (e.g., when sending an email from the chatter).
1818

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2-
access_email_layout_mapping_all,email.layout.mapping.all,model_email_layout_mapping,,1,0,0,0
2+
access_email_layout_mapping_user,email.layout.mapping.user,model_email_layout_mapping,base.group_user,1,0,0,0
33
access_email_layout_mapping_admin,email.layout.mapping.admin,model_email_layout_mapping,base.group_system,1,1,1,1

mail_layout_force/static/description/index.html

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -375,16 +375,16 @@ <h1 class="title">Mail Layout Force</h1>
375375
body when sending an email. It usually displays the related document
376376
reference, the company logo, and a small footer saying “Powered by
377377
Odoo”.</p>
378-
<p>There are notably two main layouts used in Odoo, and the user can’t
378+
<p>There are notably three main layouts used in Odoo, and the user can’t
379379
control when they’re used, as it’s hardcoded into the different
380380
applications.</p>
381381
<ul class="simple">
382-
<li><tt class="docutils literal">mail.message_notification_email</tt></li>
382+
<li><tt class="docutils literal">mail.mail_notification_layout</tt></li>
383+
<li><tt class="docutils literal">mail.mail_notification_layout_with_responsible_signature</tt></li>
383384
<li><tt class="docutils literal">mail.mail_notification_light</tt></li>
384-
<li><tt class="docutils literal">mail.mail_notification_paynow</tt></li>
385385
</ul>
386386
<p>This module allows to force a specific layout for a given
387-
<tt class="docutils literal">email.template</tt>, effectively overwritting the one hardcoded by Odoo.
387+
<tt class="docutils literal">email.template</tt>, effectively overwriting the one hardcoded by Odoo.
388388
Additionally, it enables forcing a custom layout for emails that do not
389389
use an existing <tt class="docutils literal">email.template</tt> record (e.g., when sending an email
390390
from the chatter).</p>
@@ -405,29 +405,41 @@ <h1 class="title">Mail Layout Force</h1>
405405
</div>
406406
<div class="section" id="configuration">
407407
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
408-
<p># Go to Configuration &gt; Technical &gt; Emails &gt; Templates # Open the
409-
desired <tt class="docutils literal">email.template</tt> record. # In Advanced Parameters tab, find
410-
the Force Layout field.</p>
408+
<p>To configure a forced layout for email templates:</p>
409+
<ol class="arabic simple">
410+
<li>Go to <em>Settings &gt; Technical &gt; Email &gt; Email Templates</em></li>
411+
<li>Open the desired <tt class="docutils literal">email.template</tt> record</li>
412+
<li>In the <em>Settings</em> tab, find the <em>Force Layout</em> field</li>
413+
</ol>
411414
<p>You can leave it empty to use the default email layout (chosen by Odoo).
412415
You can force a custom email layout of your own. You can use the <em>Mail:
413416
No-Layout notification template</em> to prevent Odoo from adding a layout.</p>
414417
<p>To configure a custom layout of your own, some technical knowledge is
415418
needed. You can see how the existing layouts are defined for details or
416419
inspiration:</p>
417420
<ul class="simple">
421+
<li><tt class="docutils literal">mail.mail_notification_layout</tt></li>
422+
<li><tt class="docutils literal">mail.mail_notification_layout_with_responsible_signature</tt></li>
418423
<li><tt class="docutils literal">mail.mail_notification_light</tt></li>
419-
<li><tt class="docutils literal">mail.mail_notification_paynow</tt></li>
420-
<li><tt class="docutils literal">mail.mail_notification_borders</tt></li>
421424
</ul>
422-
<p>To force a new custom layout for emails that do not use an existing
423-
<tt class="docutils literal">email.template</tt> record (e.g., emails sent from the chatter):</p>
424-
<p>#. Go to Settings &gt; Technical &gt; User Interface &gt; Views. #. Copy the
425-
current layout (e.g., mail.message_notification_email) to create a new
426-
one, and remove any parts you don’t need. #. Open the layout that you
427-
want to swap with a substitute. Then, under the Layout Mapping tab: *
428-
Set <tt class="docutils literal">Substitute Layout</tt> to the new custom layout you created. * Set
429-
<tt class="docutils literal">Models</tt> if you want to apply the replacement only to specific models.
430-
If left empty, the email layout will be replaced for all models.</p>
425+
<p>To force a custom layout for emails that do not use an existing
426+
<tt class="docutils literal">email.template</tt> record (e.g., emails sent from the chatter), you can
427+
use the Layout Mapping feature:</p>
428+
<ol class="arabic simple">
429+
<li>Go to <em>Settings &gt; Technical &gt; User Interface &gt; Views</em></li>
430+
<li>Copy the current layout (e.g.,
431+
<tt class="docutils literal">mail.mail_notification_layout_with_responsible_signature</tt>) to
432+
create a new custom layout, and customize it as needed</li>
433+
<li>Open the original layout view that you want to replace. Under the
434+
<em>Layout Mapping</em> tab:<ul>
435+
<li>Click <em>Add a line</em></li>
436+
<li>Set <em>Substitute Layout</em> to the new custom layout you created</li>
437+
<li>Set <em>Models</em> if you want to apply the replacement only to specific
438+
models. If left empty, the email layout will be replaced for all
439+
models</li>
440+
</ul>
441+
</li>
442+
</ol>
431443
</div>
432444
<div class="section" id="bug-tracker">
433445
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>

mail_layout_force/tests/test_mail_layout_force.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def setUpClass(cls):
4949
"force_email_layout_id": cls.view.id,
5050
}
5151
)
52-
cls.partner = cls.env.ref("base.res_partner_10")
52+
cls.partner = cls.env["res.partner"].create({"name": "Test Partner"})
5353
cls.partner.message_ids.unlink()
5454
cls.partner.message_subscribe([cls.partner.id])
5555

mail_layout_force/views/ir_ui_views.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
invisible="type != 'qweb'"
1313
>
1414
<field name="layout_mapping_line_ids" nolabel="1">
15-
<tree editable="bottom">
15+
<list editable="bottom">
1616
<field name="substitute_layout_id" />
1717
<field name="model_ids" widget="many2many_tags" />
18-
</tree>
18+
</list>
1919
</field>
2020
</page>
2121
</xpath>

0 commit comments

Comments
 (0)