Skip to content

Commit

Permalink
TA#26490 Add archive button in mail template (#55)
Browse files Browse the repository at this point in the history
* TA#26490 Add archive button in mail template

* TA#26490 Fix codacy issues

* Add correct translate file
  • Loading branch information
AmeGev authored Aug 27, 2020
1 parent 1cacd12 commit 79b1ae7
Show file tree
Hide file tree
Showing 11 changed files with 140 additions and 0 deletions.
1 change: 1 addition & 0 deletions .docker_files/main/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
'mail_message_from_author',
'mail_notification_no_footer',
'mail_recipient_unchecked',
'mail_template_archive',
'note_no_default_stage',
'private_data_group',
'queue_job_auto_requeue',
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ COPY mail_follower_picker /mnt/extra-addons/mail_follower_picker
COPY mail_message_from_author /mnt/extra-addons/mail_message_from_author
COPY mail_notification_no_footer /mnt/extra-addons/mail_notification_no_footer
COPY mail_recipient_unchecked /mnt/extra-addons/mail_recipient_unchecked
COPY mail_template_archive /mnt/extra-addons/mail_template_archive
COPY note_no_default_stage /mnt/extra-addons/note_no_default_stage
COPY private_data_group /mnt/extra-addons/private_data_group
COPY queue_job_auto_requeue /mnt/extra-addons/queue_job_auto_requeue
Expand Down
28 changes: 28 additions & 0 deletions mail_template_archive/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Mail Enable Archive
===================
This module enables the 'Archive' smart button in the view form of a mail template.
Furthermore, it adds two filters in the search view: 'Archived' and 'Active'.

.. contents:: Table of Contents

Form View
----------

The 'Archive' button can be found in the view form of a mail template.

.. image:: static/description/form_view_smart_button.png

Search View
------------

The 'Archived' and 'Active' filters are in the search view.

.. image:: static/description/search_view_filter.png

Contributors
------------
* Numigi (tm) and all its contributors (https://bit.ly/numigiens)

More information
----------------
* Meet us at https://bit.ly/numigi-com
4 changes: 4 additions & 0 deletions mail_template_archive/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# © 2020 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from . import models
21 changes: 21 additions & 0 deletions mail_template_archive/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# © 2020 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

{
'name': 'Mail Template Archive',
'version': '1.2.0',
'author': 'Numigi',
'maintainer': 'Numigi',
'website': 'https://www.numigi.com',
'license': 'LGPL-3',
'category': 'Base',
'summary': 'A base module to enable mail archiving',
'depends': [
'base',
'mail',
],
'data': [
'views/mail_template.xml',
],
'installable': True,
}
35 changes: 35 additions & 0 deletions mail_template_archive/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_template_archive
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-26 18:11+0000\n"
"PO-Revision-Date: 2020-08-26 14:17-0400\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Poedit 2.3\n"
"Last-Translator: \n"
"Language: fr\n"

#. module: mail_template_archive
#: model:ir.model.fields,field_description:mail_template_archive.field_email_template_preview__active
#: model:ir.model.fields,field_description:mail_template_archive.field_mail_template__active
#: model_terms:ir.ui.view,arch_db:mail_template_archive.mail_template_tree
msgid "Active"
msgstr "Actif"

#. module: mail_template_archive
#: model_terms:ir.ui.view,arch_db:mail_template_archive.mail_template_tree
msgid "Archived"
msgstr "Archivé"

#. module: mail_template_archive
#: model:ir.model,name:mail_template_archive.model_mail_template
msgid "Email Templates"
msgstr "Modèles de courriel"
4 changes: 4 additions & 0 deletions mail_template_archive/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# © 2020 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from . import mail_template
11 changes: 11 additions & 0 deletions mail_template_archive/models/mail_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# © 2020 - today Numigi (tm) and all its contributors (https://bit.ly/numigiens)
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo import fields, models


class MailTemplate(models.Model):
_inherit = 'mail.template'

active = fields.Boolean(string='Active', default=True)

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions mail_template_archive/views/mail_template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>

<record id="mail_template_form" model="ir.ui.view">
<field name="name">Mail Template Form: Add smart button archive</field>
<field name="model">mail.template</field>
<field name="inherit_id" ref="mail.email_template_form"/>
<field name="priority" eval="1"/>
<field name="arch" type="xml">
<xpath expr="//div[@class='oe_button_box']/field[@name='ref_ir_act_window']" position="before">
<button class="oe_stat_button" type="object" name="toggle_active" icon="fa-archive" groups="base.group_system">
<field name="active" widget="boolean_button" options='{"terminology": "archive"}'/>
</button>
</xpath>

</field>
</record>

<record id="mail_template_tree" model="ir.ui.view">
<field name="name">Mail Template Tree: Add filter is archived</field>
<field name="model">mail.template</field>
<field name="inherit_id" ref="mail.view_email_template_search"/>
<field name="priority" eval="1"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position="before">
<filter string="Archived" name="filter_archived" domain="[('active', '=', False)]"/>
<filter string="Active" name="filter_active" domain="[('active', '=', True)]"/>
</xpath>
</field>
</record>




</odoo>

0 comments on commit 79b1ae7

Please sign in to comment.