Skip to content

Commit

Permalink
Merge PR OCA#498 into 16.0 via patch
Browse files Browse the repository at this point in the history
  • Loading branch information
oskardotglobal committed Jul 22, 2023
1 parent 2cf618e commit a2ddf91
Show file tree
Hide file tree
Showing 19 changed files with 748 additions and 0 deletions.
100 changes: 100 additions & 0 deletions mail_template_multi_company/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
===========================
Mail Template Multi Company
===========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fmulti--company-lightgray.png?logo=github
:target: https://github.com/OCA/multi-company/tree/15.0/mail_template_multi_company
:alt: OCA/multi-company
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/multi-company-15-0/multi-company-15-0-mail_template_multi_company
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/133/15.0
:alt: Try me on Runbot

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

This module add multi-company management to mail templates.

**Table of contents**

.. contents::
:local:

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

* Go to *Settings > General Settings*
* Activate the multi-company
* Go to *Settings > User & Companies > Users*
* Select your user to edit it and active the multi-company

Usage
=====

* Go to *Settings*
* Activate the developer mode
* Go to *Settings > Technical > Email > Templates*
* Open a template and set the company field if the template is specific to a
company

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/multi-company/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/multi-company/issues/new?body=module:%20mail_template_multi_company%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
~~~~~~~

* ACSONE SA/NV

Contributors
~~~~~~~~~~~~

* Olivier Laurent <[email protected]>
* Souheil Bejaoui <[email protected]>
* Andrea Stirpe <[email protected]>

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.

.. |maintainer-Olivier-LAURENT| image:: https://github.com/Olivier-LAURENT.png?size=40px
:target: https://github.com/Olivier-LAURENT
:alt: Olivier-LAURENT

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-Olivier-LAURENT|

This module is part of the `OCA/multi-company <https://github.com/OCA/multi-company/tree/15.0/mail_template_multi_company>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
10 changes: 10 additions & 0 deletions mail_template_multi_company/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from . import models


def post_init_hook(cr, registry):
"""We should not set the company by default on all existing mail templates
when installing this module. Because many standard template need not be
specialized by company.
OTOH, when this module is installed it makes sense that new templates
being created by users have a company set by default."""
cr.execute("UPDATE mail_template SET company_id=null")
15 changes: 15 additions & 0 deletions mail_template_multi_company/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Mail Template Multi Company",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV," "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/multi-company",
"depends": ["mail"],
"post_init_hook": "post_init_hook",
"data": ["security/mail_template.xml", "views/mail_template.xml"],
"development_status": "Beta",
"maintainers": ["Olivier-LAURENT"],
}
27 changes: 27 additions & 0 deletions mail_template_multi_company/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_template_multi_company
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-03-09 17:45+0000\n"
"Last-Translator: Ana Suárez <[email protected]>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n"

#. module: mail_template_multi_company
#: model:ir.model.fields,field_description:mail_template_multi_company.field_mail_template__company_id
msgid "Company"
msgstr "Compañía"

#. module: mail_template_multi_company
#: model:ir.model,name:mail_template_multi_company.model_mail_template
msgid "Email Templates"
msgstr "Plantillas de email"
24 changes: 24 additions & 0 deletions mail_template_multi_company/i18n/mail_template_multi_company.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_template_multi_company
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: mail_template_multi_company
#: model:ir.model.fields,field_description:mail_template_multi_company.field_mail_template__company_id
msgid "Company"
msgstr ""

#. module: mail_template_multi_company
#: model:ir.model,name:mail_template_multi_company.model_mail_template
msgid "Email Templates"
msgstr ""
27 changes: 27 additions & 0 deletions mail_template_multi_company/i18n/nl.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_template_multi_company
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-06-23 19:09+0000\n"
"Last-Translator: Bosd <[email protected]>\n"
"Language-Team: none\n"
"Language: nl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: mail_template_multi_company
#: model:ir.model.fields,field_description:mail_template_multi_company.field_mail_template__company_id
msgid "Company"
msgstr "Bedrijf"

#. module: mail_template_multi_company
#: model:ir.model,name:mail_template_multi_company.model_mail_template
msgid "Email Templates"
msgstr "Email Sjablonen"
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import SUPERUSER_ID, api


def migrate(cr, version):
env = api.Environment(cr, SUPERUSER_ID, {})
domain = "['|',('company_id','=',False),('company_id','in',company_ids)]"
rule = env.ref(
"mail_template_multi_company.mail_template_company_rule",
raise_if_not_found=False,
)
if rule:
rule.write({"domain_force": domain})
1 change: 1 addition & 0 deletions mail_template_multi_company/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import mail_template
14 changes: 14 additions & 0 deletions mail_template_multi_company/models/mail_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2017 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class MailTemplate(models.Model):

_inherit = "mail.template"

company_id = fields.Many2one(
"res.company",
ondelete="set null",
)
4 changes: 4 additions & 0 deletions mail_template_multi_company/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* Go to *Settings > General Settings*
* Activate the multi-company
* Go to *Settings > User & Companies > Users*
* Select your user to edit it and active the multi-company
4 changes: 4 additions & 0 deletions mail_template_multi_company/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* Olivier Laurent <[email protected]>
* Souheil Bejaoui <[email protected]>
* Andrea Stirpe <[email protected]>
* Alberto Nieto de Pablos <[email protected]> (https://braintec.com)
1 change: 1 addition & 0 deletions mail_template_multi_company/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module add multi-company management to mail templates.
5 changes: 5 additions & 0 deletions mail_template_multi_company/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* Go to *Settings*
* Activate the developer mode
* Go to *Settings > Technical > Email > Templates*
* Open a template and set the company field if the template is specific to a
company
12 changes: 12 additions & 0 deletions mail_template_multi_company/security/mail_template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2017 ACSONE SA/NV
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="mail_template_company_rule" model="ir.rule">
<field name="name">Mail Template multi-company</field>
<field name="model_id" ref="mail.model_mail_template" />
<field name="domain_force">
['|',('company_id','=',False),('company_id','in',company_ids)]
</field>
</record>
</odoo>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a2ddf91

Please sign in to comment.