Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions mass_mailing_multi_company/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

==========================
Mass Mailing Multi Company
==========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9d9ebcf1a8ccd3054acfa7495237bcc835a033659e9cd196c37c42ad1b024888
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/license-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/19.0/mass_mailing_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-19-0/multi-company-19-0-mass_mailing_multi_company
: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/multi-company&target_branch=19.0
:alt: Try me on Runboat

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

This module adds the company_id field to the models mailing.mailing,
mailing.list, mailing.contact and mailing.contact.subscription. It also
ensures that the lists available for selection in the mailing.mailing
and mailing.contact forms are restricted by the company_id value. For
the mailing.mailing domain, an expression matching only contacts/mailing
contacts with the same company or without company is added when parsing
the domain.

**Table of contents**

.. contents::
:local:

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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/multi-company/issues/new?body=module:%20mass_mailing_multi_company%0Aversion:%2019.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
-------

* ForgeFlow S.L.

Contributors
------------

- Marina Alapont <marina.alapont@forgeflow.com>
- Jasmin Solanki <jasmin.solanki@forgeflow.com>

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/multi-company <https://github.com/OCA/multi-company/tree/19.0/mass_mailing_multi_company>`_ 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 mass_mailing_multi_company/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
19 changes: 19 additions & 0 deletions mass_mailing_multi_company/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2024 ForgeFlow S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Mass Mailing Multi Company",
"summary": "Adds the company_id field to the models mailing.mailing,"
" mailing.list and mailing.contact",
"version": "19.0.1.0.0",
"license": "AGPL-3",
"author": "ForgeFlow S.L., Odoo Community Association (OCA)",
"website": "https://github.com/OCA/multi-company",
"depends": ["mass_mailing"],
"data": [
"security/mass_mailing.xml",
"views/mailing_mailing_views.xml",
"views/mailing_list_views.xml",
"views/mailing_contact_views.xml",
],
}
60 changes: 60 additions & 0 deletions mass_mailing_multi_company/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mass_mailing_multi_company
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-03-20 13:06+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\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 5.10.2\n"

#. module: mass_mailing_multi_company
#: model:ir.model.fields,field_description:mass_mailing_multi_company.field_mailing_contact__company_id
#: model:ir.model.fields,field_description:mass_mailing_multi_company.field_mailing_contact_subscription__company_id
#: model:ir.model.fields,field_description:mass_mailing_multi_company.field_mailing_list__company_id
#: model:ir.model.fields,field_description:mass_mailing_multi_company.field_mailing_mailing__company_id
msgid "Company"
msgstr "Azienda"

#. module: mass_mailing_multi_company
#: model_terms:ir.ui.view,arch_db:mass_mailing_multi_company.view_mail_mass_mailing_form_inherit
msgid "MISC"
msgstr "VARIE"

#. module: mass_mailing_multi_company
#: model:ir.model,name:mass_mailing_multi_company.model_mailing_contact
msgid "Mailing Contact"
msgstr "Contatto spedizione"

#. module: mass_mailing_multi_company
#: model:ir.model,name:mass_mailing_multi_company.model_mailing_list
msgid "Mailing List"
msgstr "Mailing list"

#. module: mass_mailing_multi_company
#: model:ir.model,name:mass_mailing_multi_company.model_mailing_mailing
msgid "Mass Mailing"
msgstr "Spedizione di massa"

#. module: mass_mailing_multi_company
#: model:ir.model,name:mass_mailing_multi_company.model_mailing_contact_subscription
msgid "Mass Mailing Subscription Information"
msgstr "Informazione iscrizione spedizioni di massa"

#. module: mass_mailing_multi_company
#: model_terms:ir.ui.view,arch_db:mass_mailing_multi_company.view_mail_mass_mailing_form_inherit
msgid ""
"Since the newsletter company field is specified, an additional filter will "
"be applied to the domain, ensuring records are filtered by the company ID."
msgstr ""
"Poiché è specificato il campo aziendale della newsletter, al dominio verrà "
"applicato un filtro aggiuntivo, assicurando che i record vengano filtrati in "
"base all'ID aziendale."
54 changes: 54 additions & 0 deletions mass_mailing_multi_company/i18n/mass_mailing_multi_company.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mass_mailing_multi_company
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.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: mass_mailing_multi_company
#: model:ir.model.fields,field_description:mass_mailing_multi_company.field_mailing_contact__company_id
#: model:ir.model.fields,field_description:mass_mailing_multi_company.field_mailing_contact_subscription__company_id
#: model:ir.model.fields,field_description:mass_mailing_multi_company.field_mailing_list__company_id
#: model:ir.model.fields,field_description:mass_mailing_multi_company.field_mailing_mailing__company_id
msgid "Company"
msgstr ""

#. module: mass_mailing_multi_company
#: model_terms:ir.ui.view,arch_db:mass_mailing_multi_company.view_mail_mass_mailing_form_inherit
msgid "MISC"
msgstr ""

#. module: mass_mailing_multi_company
#: model:ir.model,name:mass_mailing_multi_company.model_mailing_contact
msgid "Mailing Contact"
msgstr ""

#. module: mass_mailing_multi_company
#: model:ir.model,name:mass_mailing_multi_company.model_mailing_list
msgid "Mailing List"
msgstr ""

#. module: mass_mailing_multi_company
#: model:ir.model,name:mass_mailing_multi_company.model_mailing_mailing
msgid "Mass Mailing"
msgstr ""

#. module: mass_mailing_multi_company
#: model:ir.model,name:mass_mailing_multi_company.model_mailing_contact_subscription
msgid "Mass Mailing Subscription Information"
msgstr ""

#. module: mass_mailing_multi_company
#: model_terms:ir.ui.view,arch_db:mass_mailing_multi_company.view_mail_mass_mailing_form_inherit
msgid ""
"Since the newsletter company field is specified, an additional filter will "
"be applied to the domain, ensuring records are filtered by the company ID."
msgstr ""
4 changes: 4 additions & 0 deletions mass_mailing_multi_company/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import mailing_contact
from . import mailing_mailing
from . import mailing_list
from . import mailing_subscription
11 changes: 11 additions & 0 deletions mass_mailing_multi_company/models/mailing_contact.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright 2024 ForgeFlow S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


from odoo import fields, models


class MassMailingContact(models.Model):
_inherit = "mailing.contact"

company_id = fields.Many2one("res.company", "Company")
10 changes: 10 additions & 0 deletions mass_mailing_multi_company/models/mailing_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2024 ForgeFlow S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class MassMailingList(models.Model):
_inherit = "mailing.list"

company_id = fields.Many2one("res.company", "Company")
40 changes: 40 additions & 0 deletions mass_mailing_multi_company/models/mailing_mailing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2024 ForgeFlow S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models
from odoo.fields import Domain


class MassMailing(models.Model):
_inherit = "mailing.mailing"

company_id = fields.Many2one("res.company", "Company")

def _get_recipients(self):
res_ids = super()._get_recipients()
if self.company_id:
records = self.env[self.mailing_model_real].browse(res_ids)
res_ids = records.filtered(
lambda r: not r.company_id or r.company_id == self.company_id
).ids
return res_ids

def _compute_total(self):
res = super()._compute_total()
for mailing in self:
if mailing.company_id:
domain = Domain.AND(
[
mailing._parse_mailing_domain(),
[
"|",
("company_id", "=", mailing.company_id.id),
("company_id", "=", False),
],
]
)
total = self.env[mailing.mailing_model_real].search_count(domain)
if total and mailing.ab_testing_enabled and mailing.ab_testing_pc < 100:
total = max(int(total / 100.0 * mailing.ab_testing_pc), 1)
mailing.total = total
return res
12 changes: 12 additions & 0 deletions mass_mailing_multi_company/models/mailing_subscription.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2024 ForgeFlow S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class MailingSubscription(models.Model):
_inherit = "mailing.subscription"

company_id = fields.Many2one(
"res.company", "Company", related="contact_id.company_id"
)
3 changes: 3 additions & 0 deletions mass_mailing_multi_company/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions mass_mailing_multi_company/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Marina Alapont \<marina.alapont@forgeflow.com\>
- Jasmin Solanki \<jasmin.solanki@forgeflow.com\>
7 changes: 7 additions & 0 deletions mass_mailing_multi_company/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This module adds the company_id field to the models mailing.mailing,
mailing.list, mailing.contact and mailing.contact.subscription. It also
ensures that the lists available for selection in the mailing.mailing
and mailing.contact forms are restricted by the company_id value. For
the mailing.mailing domain, an expression matching only contacts/mailing
contacts with the same company or without company is added when parsing
the domain.
27 changes: 27 additions & 0 deletions mass_mailing_multi_company/security/mass_mailing.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<!-- mailing.mailing -->
<record model="ir.rule" id="mailing_mailing_rule">
<field name="name">mailing.mailing multi-company</field>
<field name="model_id" ref="mass_mailing.model_mailing_mailing" />
<field name="domain_force">
['|',('company_id','=',False),('company_id','in',company_ids)]
</field>
</record>
<!-- mailing.list -->
<record model="ir.rule" id="mailing_list_rule">
<field name="name">mailing.list multi-company</field>
<field name="model_id" ref="mass_mailing.model_mailing_list" />
<field name="domain_force">
['|',('company_id','=',False),('company_id','in',company_ids)]
</field>
</record>
<!-- mailing.contact -->
<record model="ir.rule" id="mailing_contact_rule">
<field name="name">mailing.contact multi-company</field>
<field name="model_id" ref="mass_mailing.model_mailing_contact" />
<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