[IMP] mail_notification_custom_subject: pre-commit auto fixes

pull/1349/head
maciej-wichowski 2024-04-09 11:46:14 +02:00
parent af068ba09a
commit f7b15d4e6f
11 changed files with 91 additions and 79 deletions

View File

@ -17,19 +17,19 @@ Mail Notification Custom Subject
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
:target: https://github.com/OCA/social/tree/15.0/mail_notification_custom_subject :target: https://github.com/OCA/social/tree/17.0/mail_notification_custom_subject
:alt: OCA/social :alt: OCA/social
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/social-15-0/social-15-0-mail_notification_custom_subject :target: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_notification_custom_subject
:alt: Translate me on Weblate :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=15.0 :target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=17.0
:alt: Try me on Runboat :alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5| |badge1| |badge2| |badge3| |badge4| |badge5|
This module allows you to specify templates to override the subject on the notification This module allows you to specify templates to override the subject on
emails sent by Odoo the notification emails sent by Odoo
**Table of contents** **Table of contents**
@ -39,23 +39,29 @@ emails sent by Odoo
Configuration Configuration
============= =============
- Activate access to **Technical Features** (debug mode).
* Activate access to **Technical Features** (debug mode). - Go to **Settings > Technical > Email > Subject Replacement
* Go to **Settings > Technical > Email > Subject Replacement Templates** Templates**
* Create a new template.
* The field **Model** specifies the model to which the subject template should apply in the notification emails sent by Odoo. - Create a new template.
* The field **Subject Template** accepts `Jinja <https://jinja.palletsprojects.com/en/2.11.x/>`__ expressions.
* The field **Replace** specifies if the template should replace existing content or append to it. - The field **Model** specifies the model to which the subject
template should apply in the notification emails sent by Odoo.
- The field **Subject Template** accepts
`Jinja <https://jinja.palletsprojects.com/en/2.11.x/>`__
expressions.
- The field **Replace** specifies if the template should replace
existing content or append to it.
Usage Usage
===== =====
To use this module, you need to: To use this module, you need to:
* Open the chatter in Odoo (e.g. Open an Invoice). - Open the chatter in Odoo (e.g. Open an Invoice).
* Send a message. - Send a message.
* Observe the rendered Subject template. - Observe the rendered Subject template.
Bug Tracker Bug Tracker
=========== ===========
@ -63,7 +69,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_. Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_notification_custom_subject%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. `feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_notification_custom_subject%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues. Do not contact contributors directly about support or help with technical issues.
@ -71,28 +77,30 @@ Credits
======= =======
Authors Authors
~~~~~~~ -------
* Tecnativa * Tecnativa
Contributors Contributors
~~~~~~~~~~~~ ------------
* Tecnativa <https://www.tecnativa.com> - Tecnativa <https://www.tecnativa.com>
* Pedro M. Baeza - Pedro M. Baeza
* João Marques - João Marques
* Carlos Roca - Carlos Roca
* Víctor Martínez - Víctor Martínez
* Versada <https://versada.eu> - Versada <https://versada.eu>
* Naglis Jonaitis
* Moduon <https://www.moduon.team> - Naglis Jonaitis
* Eduardo de Miguel
- Moduon <https://www.moduon.team>
- Eduardo de Miguel
Maintainers Maintainers
~~~~~~~~~~~ -----------
This module is maintained by the OCA. This module is maintained by the OCA.
@ -112,6 +120,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-yajo| |maintainer-yajo|
This module is part of the `OCA/social <https://github.com/OCA/social/tree/15.0/mail_notification_custom_subject>`_ project on GitHub. This module is part of the `OCA/social <https://github.com/OCA/social/tree/17.0/mail_notification_custom_subject>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -26,7 +26,7 @@ class MailThread(models.AbstractModel):
attachment_ids=None, attachment_ids=None,
add_sign=True, add_sign=True,
record_name=False, record_name=False,
**kwargs **kwargs,
): ):
if subtype_xmlid: if subtype_xmlid:
subtype_id = self.env["ir.model.data"]._xmlid_to_res_id( subtype_id = self.env["ir.model.data"]._xmlid_to_res_id(
@ -60,9 +60,7 @@ class MailThread(models.AbstractModel):
template_src=template.subject_template, template_src=template.subject_template,
model=self._name, model=self._name,
res_ids=[self.id], res_ids=[self.id],
)[ )[self.id]
self.id
]
if template.position == "replace": if template.position == "replace":
subject = rendered_subject_template subject = rendered_subject_template
elif template.position == "append_before": elif template.position == "append_before":

View File

@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"

View File

@ -0,0 +1,13 @@
- Activate access to **Technical Features** (debug mode).
- Go to **Settings \> Technical \> Email \> Subject Replacement
Templates**
- Create a new template.
> - The field **Model** specifies the model to which the subject
> template should apply in the notification emails sent by Odoo.
> - The field **Subject Template** accepts
> [Jinja](https://jinja.palletsprojects.com/en/2.11.x/) expressions.
> - The field **Replace** specifies if the template should replace
> existing content or append to it.

View File

@ -1,8 +0,0 @@
* Activate access to **Technical Features** (debug mode).
* Go to **Settings > Technical > Email > Subject Replacement Templates**
* Create a new template.
* The field **Model** specifies the model to which the subject template should apply in the notification emails sent by Odoo.
* The field **Subject Template** accepts `Jinja <https://jinja.palletsprojects.com/en/2.11.x/>`__ expressions.
* The field **Replace** specifies if the template should replace existing content or append to it.

View File

@ -0,0 +1,12 @@
- Tecnativa \<<https://www.tecnativa.com>\>
> - Pedro M. Baeza
> - João Marques
> - Carlos Roca
> - Víctor Martínez
- Versada \<<https://versada.eu>\>
- Naglis Jonaitis
- Moduon \<<https://www.moduon.team>\>
- Eduardo de Miguel

View File

@ -1,12 +0,0 @@
* Tecnativa <https://www.tecnativa.com>
* Pedro M. Baeza
* João Marques
* Carlos Roca
* Víctor Martínez
* Versada <https://versada.eu>
* Naglis Jonaitis
* Moduon <https://www.moduon.team>
* Eduardo de Miguel

View File

@ -1,2 +1,2 @@
This module allows you to specify templates to override the subject on the notification This module allows you to specify templates to override the subject on
emails sent by Odoo the notification emails sent by Odoo

View File

@ -0,0 +1,5 @@
To use this module, you need to:
- Open the chatter in Odoo (e.g. Open an Invoice).
- Send a message.
- Observe the rendered Subject template.

View File

@ -1,5 +0,0 @@
To use this module, you need to:
* Open the chatter in Odoo (e.g. Open an Invoice).
* Send a message.
* Observe the rendered Subject template.

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> <head>
@ -369,9 +368,9 @@ ul.auto-toc {
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:b873c6dfb9d094a1b5ebcd5c16a0c39a2127f4e7707aa54dd51dd4049f65d3fe !! source digest: sha256:b873c6dfb9d094a1b5ebcd5c16a0c39a2127f4e7707aa54dd51dd4049f65d3fe
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/social/tree/15.0/mail_notification_custom_subject"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/social-15-0/social-15-0-mail_notification_custom_subject"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/social&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p> <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/social/tree/17.0/mail_notification_custom_subject"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_notification_custom_subject"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/social&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows you to specify templates to override the subject on the notification <p>This module allows you to specify templates to override the subject on
emails sent by Odoo</p> the notification emails sent by Odoo</p>
<p><strong>Table of contents</strong></p> <p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents"> <div class="contents local topic" id="contents">
<ul class="simple"> <ul class="simple">
@ -391,14 +390,19 @@ emails sent by Odoo</p>
<ul> <ul>
<li><p class="first">Activate access to <strong>Technical Features</strong> (debug mode).</p> <li><p class="first">Activate access to <strong>Technical Features</strong> (debug mode).</p>
</li> </li>
<li><p class="first">Go to <strong>Settings &gt; Technical &gt; Email &gt; Subject Replacement Templates</strong></p> <li><p class="first">Go to <strong>Settings &gt; Technical &gt; Email &gt; Subject Replacement
Templates</strong></p>
</li> </li>
<li><p class="first">Create a new template.</p> <li><p class="first">Create a new template.</p>
<blockquote> <blockquote>
<ul class="simple"> <ul class="simple">
<li>The field <strong>Model</strong> specifies the model to which the subject template should apply in the notification emails sent by Odoo.</li> <li>The field <strong>Model</strong> specifies the model to which the subject
<li>The field <strong>Subject Template</strong> accepts <a class="reference external" href="https://jinja.palletsprojects.com/en/2.11.x/">Jinja</a> expressions.</li> template should apply in the notification emails sent by Odoo.</li>
<li>The field <strong>Replace</strong> specifies if the template should replace existing content or append to it.</li> <li>The field <strong>Subject Template</strong> accepts
<a class="reference external" href="https://jinja.palletsprojects.com/en/2.11.x/">Jinja</a>
expressions.</li>
<li>The field <strong>Replace</strong> specifies if the template should replace
existing content or append to it.</li>
</ul> </ul>
</blockquote> </blockquote>
</li> </li>
@ -418,7 +422,7 @@ emails sent by Odoo</p>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>. <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported. In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_notification_custom_subject%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p> <a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_notification_custom_subject%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p> <p>Do not contact contributors directly about support or help with technical issues.</p>
</div> </div>
<div class="section" id="credits"> <div class="section" id="credits">
@ -442,21 +446,15 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
</ul> </ul>
</blockquote> </blockquote>
</li> </li>
<li><dl class="first docutils"> <li><p class="first">Versada &lt;<a class="reference external" href="https://versada.eu">https://versada.eu</a>&gt;</p>
<dt>Versada &lt;<a class="reference external" href="https://versada.eu">https://versada.eu</a>&gt;</dt> <ul class="simple">
<dd><ul class="first last simple">
<li>Naglis Jonaitis</li> <li>Naglis Jonaitis</li>
</ul> </ul>
</dd>
</dl>
</li> </li>
<li><dl class="first docutils"> <li><p class="first">Moduon &lt;<a class="reference external" href="https://www.moduon.team">https://www.moduon.team</a>&gt;</p>
<dt>Moduon &lt;<a class="reference external" href="https://www.moduon.team">https://www.moduon.team</a>&gt;</dt> <ul class="simple">
<dd><ul class="first last simple">
<li>Eduardo de Miguel</li> <li>Eduardo de Miguel</li>
</ul> </ul>
</dd>
</dl>
</li> </li>
</ul> </ul>
</div> </div>
@ -469,7 +467,7 @@ mission is to support the collaborative development of Odoo features and
promote its widespread use.</p> promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p> <p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/yajo"><img alt="yajo" src="https://github.com/yajo.png?size=40px" /></a></p> <p><a class="reference external image-reference" href="https://github.com/yajo"><img alt="yajo" src="https://github.com/yajo.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/15.0/mail_notification_custom_subject">OCA/social</a> project on GitHub.</p> <p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/17.0/mail_notification_custom_subject">OCA/social</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p> <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div> </div>
</div> </div>