[MIG] mail_notification_custom_subject: Migration to 15.0
TT36470
This commit is contained in:
parent
bdfaa139d5
commit
38638654fc
@ -14,13 +14,13 @@ Mail Notification Custom Subject
|
||||
: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/14.0/mail_notification_custom_subject
|
||||
:target: https://github.com/OCA/social/tree/15.0/mail_notification_custom_subject
|
||||
:alt: OCA/social
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/social-14-0/social-14-0-mail_notification_custom_subject
|
||||
:target: https://translation.odoo-community.org/projects/social-15-0/social-15-0-mail_notification_custom_subject
|
||||
:alt: Translate me on Weblate
|
||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||
:target: https://runbot.odoo-community.org/runbot/205/14.0
|
||||
:target: https://runbot.odoo-community.org/runbot/205/15.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
@ -60,7 +60,7 @@ 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 smashing it by providing a detailed and welcomed
|
||||
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_notification_custom_subject%0Aversion:%2014.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:%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.
|
||||
|
||||
@ -105,6 +105,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|
||||
|
||||
|maintainer-joao-p-marques|
|
||||
|
||||
This module is part of the `OCA/social <https://github.com/OCA/social/tree/14.0/mail_notification_custom_subject>`_ project on GitHub.
|
||||
This module is part of the `OCA/social <https://github.com/OCA/social/tree/15.0/mail_notification_custom_subject>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
@ -5,7 +5,7 @@
|
||||
{
|
||||
"name": "Mail Notification Custom Subject",
|
||||
"summary": "Apply a custom subject to mail notifications",
|
||||
"version": "14.0.1.0.0",
|
||||
"version": "15.0.1.0.0",
|
||||
"category": "Social Network",
|
||||
"website": "https://github.com/OCA/social",
|
||||
"author": "Tecnativa, Odoo Community Association (OCA)",
|
||||
|
@ -22,7 +22,6 @@ class MailMessageCustomSubject(models.Model):
|
||||
required=True,
|
||||
)
|
||||
subject_template = fields.Char(
|
||||
string="Subject Template",
|
||||
required=True,
|
||||
help="Subject (placeholders may be used here)",
|
||||
)
|
||||
@ -32,7 +31,6 @@ class MailMessageCustomSubject(models.Model):
|
||||
("append_after", "Append After"),
|
||||
("replace", "Replace"),
|
||||
],
|
||||
string="Position",
|
||||
default="replace",
|
||||
help="Whether to replace, append at beggining or append at end to other"
|
||||
" templates that apply to a given context",
|
||||
|
@ -21,7 +21,6 @@ class MailThread(models.AbstractModel):
|
||||
subtype_xmlid=None,
|
||||
subtype_id=False,
|
||||
partner_ids=None,
|
||||
channel_ids=None,
|
||||
attachments=None,
|
||||
attachment_ids=None,
|
||||
add_sign=True,
|
||||
@ -29,7 +28,7 @@ class MailThread(models.AbstractModel):
|
||||
**kwargs
|
||||
):
|
||||
if not subtype_id and subtype_xmlid:
|
||||
subtype_id = self.env["ir.model.data"].xmlid_to_res_id(
|
||||
subtype_id = self.env["ir.model.data"]._xmlid_to_res_id(
|
||||
subtype_xmlid,
|
||||
raise_if_not_found=False,
|
||||
)
|
||||
@ -71,7 +70,6 @@ class MailThread(models.AbstractModel):
|
||||
subtype_xmlid=subtype_xmlid,
|
||||
subtype_id=subtype_id,
|
||||
partner_ids=partner_ids,
|
||||
channel_ids=channel_ids,
|
||||
attachments=attachments,
|
||||
attachment_ids=attachment_ids,
|
||||
add_sign=add_sign,
|
||||
|
@ -3,6 +3,7 @@
|
||||
* Pedro M. Baeza
|
||||
* João Marques
|
||||
* Carlos Roca
|
||||
* Víctor Martínez
|
||||
|
||||
* Versada <https://versada.eu>
|
||||
* Naglis Jonaitis
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
|
||||
<title>Mail Notification Custom Subject</title>
|
||||
<style type="text/css">
|
||||
|
||||
@ -367,7 +367,7 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external" 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" 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" href="https://github.com/OCA/social/tree/14.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" href="https://translation.odoo-community.org/projects/social-14-0/social-14-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" href="https://runbot.odoo-community.org/runbot/205/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p><a class="reference external" 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" 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" 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" 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" href="https://runbot.odoo-community.org/runbot/205/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module allows you to specify templates to override the subject on the notification
|
||||
emails sent by Odoo</p>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
@ -416,7 +416,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>.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us smashing 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:%2014.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:%2015.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>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
@ -458,7 +458,7 @@ mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.</p>
|
||||
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
|
||||
<p><a class="reference external" href="https://github.com/joao-p-marques"><img alt="joao-p-marques" src="https://github.com/joao-p-marques.png?size=40px" /></a></p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/14.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/15.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>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,11 +1,12 @@
|
||||
# Copyright 2020 Tecnativa - João Marques
|
||||
# Copyright 2022 Tecnativa - Víctor Martínez
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
# pylint: disable=C8107
|
||||
from odoo.tests import common
|
||||
from odoo.tools import mute_logger
|
||||
|
||||
|
||||
class TestMailNotificationCustomSubject(common.SavepointCase):
|
||||
class TestMailNotificationCustomSubject(common.TransactionCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
@ -26,7 +27,7 @@ class TestMailNotificationCustomSubject(common.SavepointCase):
|
||||
"name": "Test template 1",
|
||||
"model_id": self.env.ref("base.model_res_partner").id,
|
||||
"subtype_ids": [(6, 0, [self.env.ref("mail.mt_comment").id])],
|
||||
"subject_template": "${object.name or 'n/a'} and something more",
|
||||
"subject_template": "{{object.name or 'n/a'}} and something more",
|
||||
}
|
||||
)
|
||||
# Send message in partner
|
||||
@ -56,7 +57,7 @@ class TestMailNotificationCustomSubject(common.SavepointCase):
|
||||
"name": "Test template 1",
|
||||
"model_id": self.env.ref("base.model_res_partner").id,
|
||||
"subtype_ids": [(6, 0, [self.env.ref("mail.mt_comment").id])],
|
||||
"subject_template": "${object.name or 'n/a'} and something more",
|
||||
"subject_template": "{{object.name or 'n/a'}} and something more",
|
||||
}
|
||||
)
|
||||
# Send note in partner
|
||||
@ -72,7 +73,7 @@ class TestMailNotificationCustomSubject(common.SavepointCase):
|
||||
"name": "Test template 1",
|
||||
"model_id": self.env.ref("base.model_res_partner").id,
|
||||
"subtype_ids": [(6, 0, [self.env.ref("mail.mt_comment").id])],
|
||||
"subject_template": "${object.name or 'n/a'} and something more",
|
||||
"subject_template": "{{object.name or 'n/a'}} and something more",
|
||||
}
|
||||
)
|
||||
self.env["mail.message.custom.subject"].create(
|
||||
@ -80,7 +81,7 @@ class TestMailNotificationCustomSubject(common.SavepointCase):
|
||||
"name": "Test template 2",
|
||||
"model_id": self.env.ref("base.model_res_partner").id,
|
||||
"subtype_ids": [(6, 0, [self.env.ref("mail.mt_comment").id])],
|
||||
"subject_template": "${object.name or 'n/a'} and something different",
|
||||
"subject_template": "{{object.name or 'n/a'}} and something different",
|
||||
}
|
||||
)
|
||||
# Send message in partner
|
||||
@ -96,7 +97,7 @@ class TestMailNotificationCustomSubject(common.SavepointCase):
|
||||
"name": "Test template 3",
|
||||
"model_id": self.env.ref("base.model_res_partner").id,
|
||||
"subtype_ids": [(6, 0, [self.env.ref("mail.mt_comment").id])],
|
||||
"subject_template": "${' and yet something else'}",
|
||||
"subject_template": "{{' and yet something else'}}",
|
||||
"position": "append_after",
|
||||
}
|
||||
)
|
||||
@ -114,7 +115,7 @@ class TestMailNotificationCustomSubject(common.SavepointCase):
|
||||
"name": "Test template 4",
|
||||
"model_id": self.env.ref("base.model_res_partner").id,
|
||||
"subtype_ids": [(6, 0, [self.env.ref("mail.mt_comment").id])],
|
||||
"subject_template": "${'Re: '}",
|
||||
"subject_template": "{{'Re: '}}",
|
||||
"position": "append_before",
|
||||
}
|
||||
)
|
||||
@ -134,7 +135,7 @@ class TestMailNotificationCustomSubject(common.SavepointCase):
|
||||
"name": "Test template 1",
|
||||
"model_id": self.env.ref("base.model_res_partner").id,
|
||||
"subtype_ids": [(6, 0, [self.env.ref("mail.mt_comment").id])],
|
||||
"subject_template": "${' and something more'}",
|
||||
"subject_template": "{{' and something more'}}",
|
||||
"position": "append_after",
|
||||
}
|
||||
)
|
||||
@ -154,7 +155,7 @@ class TestMailNotificationCustomSubject(common.SavepointCase):
|
||||
"name": "Test bad template 1",
|
||||
"model_id": self.env.ref("base.model_res_partner").id,
|
||||
"subtype_ids": [(6, 0, [self.env.ref("mail.mt_comment").id])],
|
||||
"subject_template": "${obaject.number_a} and something",
|
||||
"subject_template": "{{obaject.number_a}} and something",
|
||||
"position": "append_after",
|
||||
}
|
||||
)
|
||||
|
@ -1,59 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="mail_notification_custom_subject_form">
|
||||
<field name="name">mail.message.custom.subject.form</field>
|
||||
<field name="model">mail.message.custom.subject</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Subject Replacement Templates">
|
||||
<sheet>
|
||||
<div class="oe_title">
|
||||
<label for="name" class="oe_edit_only" />
|
||||
<h1 name="name"><field name="name" /></h1>
|
||||
</div>
|
||||
<group>
|
||||
<field
|
||||
name="subject_template"
|
||||
placeholder="Subject (placeholders may be used here)"
|
||||
/>
|
||||
<field name="model_id" options="{'no_create': True}" />
|
||||
<field name="subtype_ids" widget="many2many_tags" />
|
||||
<field name="position" />
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="mail_notification_custom_subject_tree">
|
||||
<field name="name">mail.message.custom.subject.tree</field>
|
||||
<field name="model">mail.message.custom.subject</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="name" />
|
||||
<field name="model_id" />
|
||||
<field name="subtype_ids" />
|
||||
<field name="subject_template" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record
|
||||
model="ir.actions.act_window"
|
||||
id="action_mail_notification_custom_subject_tree_all"
|
||||
>
|
||||
<field name="name">Subject Replacement Templates</field>
|
||||
<field name="res_model">mail.message.custom.subject</field>
|
||||
<field name="view_mode">form,tree</field>
|
||||
<field name="view_id" ref="mail_notification_custom_subject_tree" />
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
id="menu_mail_notification_custom_subject"
|
||||
parent="base.menu_email"
|
||||
action="action_mail_notification_custom_subject_tree_all"
|
||||
sequence="21"
|
||||
/>
|
||||
|
||||
</data>
|
||||
<record model="ir.ui.view" id="mail_notification_custom_subject_form">
|
||||
<field name="name">mail.message.custom.subject.form</field>
|
||||
<field name="model">mail.message.custom.subject</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Subject Replacement Templates">
|
||||
<sheet>
|
||||
<div class="oe_title">
|
||||
<label for="name" class="oe_edit_only" />
|
||||
<h1 name="name"><field name="name" /></h1>
|
||||
</div>
|
||||
<group>
|
||||
<field
|
||||
name="subject_template"
|
||||
placeholder="Subject (placeholders may be used here)"
|
||||
/>
|
||||
<field name="model_id" options="{'no_create': True}" />
|
||||
<field name="subtype_ids" widget="many2many_tags" />
|
||||
<field name="position" />
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="mail_notification_custom_subject_tree">
|
||||
<field name="name">mail.message.custom.subject.tree</field>
|
||||
<field name="model">mail.message.custom.subject</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="name" />
|
||||
<field name="model_id" />
|
||||
<field name="subtype_ids" />
|
||||
<field name="subject_template" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record
|
||||
model="ir.actions.act_window"
|
||||
id="action_mail_notification_custom_subject_tree_all"
|
||||
>
|
||||
<field name="name">Subject Replacement Templates</field>
|
||||
<field name="res_model">mail.message.custom.subject</field>
|
||||
<field name="view_mode">form,tree</field>
|
||||
<field name="view_id" ref="mail_notification_custom_subject_tree" />
|
||||
</record>
|
||||
<menuitem
|
||||
id="menu_mail_notification_custom_subject"
|
||||
parent="base.menu_email"
|
||||
action="action_mail_notification_custom_subject_tree_all"
|
||||
sequence="21"
|
||||
/>
|
||||
</odoo>
|
||||
|
Loading…
Reference in New Issue
Block a user