Skip to content

Commit

Permalink
[ADD] mail_hide_footer_signature
Browse files Browse the repository at this point in the history
  • Loading branch information
AungKoKoLin1997 committed Feb 19, 2025
1 parent 8101349 commit 38de628
Show file tree
Hide file tree
Showing 13 changed files with 615 additions and 0 deletions.
80 changes: 80 additions & 0 deletions mail_hide_footer_signature/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
==========================
Mail Hide Footer Signature
==========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:124e70f22952a3d58f11411800ec158854a29cb59f4bf6850b02a0717496a6b2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
:target: https://github.com/OCA/social/tree/15.0/mail_hide_footer_signature
:alt: OCA/social
.. |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_hide_footer_signature
:alt: Translate me on Weblate
.. |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
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows hiding the email footer for a specific model by enabling the hide_email_footer option.

**Table of contents**

.. contents::
:local:

Configuration
=============

To hide the email footer for a specific model:

1. Go to Settings > Technical > Models.
2. Select the model for which you want to hide the footer in emails.
3. Enable Hide Email Footer.

Bug Tracker
===========

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.
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_hide_footer_signature%0Aversion:%2015.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.

Credits
=======

Authors
~~~~~~~

* Quartile

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/social <https://github.com/OCA/social/tree/15.0/mail_hide_footer_signature>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions mail_hide_footer_signature/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
16 changes: 16 additions & 0 deletions mail_hide_footer_signature/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2025 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Mail Hide Footer Signature",
"version": "15.0.1.0.0",
"category": "Mail",
"author": "Quartile, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/social",
"depends": ["mail"],
"license": "AGPL-3",
"data": [
"data/mail_template.xml",
"views/ir_model_views.xml",
],
"installable": True,
}
15 changes: 15 additions & 0 deletions mail_hide_footer_signature/data/mail_template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<odoo>
<template
id="message_notification_email_inherit"
inherit_id="mail.message_notification_email"
>
<xpath
expr="//div[@t-out='signature']/following-sibling::p[1]"
position="attributes"
>
<attribute
name="t-if"
>not record.env.context.get('hide_mail_footer')</attribute>
</xpath>
</template>
</odoo>
2 changes: 2 additions & 0 deletions mail_hide_footer_signature/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import mail_thread
from . import ir_model
13 changes: 13 additions & 0 deletions mail_hide_footer_signature/models/ir_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2025 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class IrModel(models.Model):
_inherit = "ir.model"

hide_email_footer = fields.Boolean(
help="If enabled, emails sent from records of this model will hide the "
"email footer (Sent by [Company Name] using Odoo)."
)
39 changes: 39 additions & 0 deletions mail_hide_footer_signature/models/mail_thread.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2025 Quartile (https://www.quartile.co)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models


class MailThread(models.AbstractModel):
_inherit = "mail.thread"

def _notify_record_by_email(
self,
message,
recipients_data,
msg_vals=False,
model_description=False,
mail_auto_delete=True,
check_existing=False,
force_send=True,
send_after_commit=True,
**kwargs
):
model = msg_vals.get("model") if msg_vals else message.model
if model:
model_obj = (
self.env["ir.model"].sudo().search([("model", "=", model)], limit=1)
)
if model_obj.hide_email_footer:
self = self.with_context(hide_mail_footer=True)

Check warning on line 28 in mail_hide_footer_signature/models/mail_thread.py

View check run for this annotation

Codecov / codecov/patch

mail_hide_footer_signature/models/mail_thread.py#L28

Added line #L28 was not covered by tests
return super()._notify_record_by_email(
message,
recipients_data,
msg_vals=msg_vals,
model_description=model_description,
mail_auto_delete=mail_auto_delete,
check_existing=check_existing,
force_send=force_send,
send_after_commit=send_after_commit,
**kwargs
)
5 changes: 5 additions & 0 deletions mail_hide_footer_signature/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To hide the email footer for a specific model:

1. Go to Settings > Technical > Models.
2. Select the model for which you want to hide the footer in emails.
3. Enable Hide Email Footer.
1 change: 1 addition & 0 deletions mail_hide_footer_signature/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module allows hiding the email footer for a specific model by enabling the hide_email_footer option.
Loading

0 comments on commit 38de628

Please sign in to comment.