[MIG] mass_mailing_partner: Migration to 15.0

pull/1084/head
emagdalenaC2i 2022-01-01 16:25:45 +01:00 committed by Pedro M. Baeza
parent 30c28d4773
commit f565e1078b
6 changed files with 27 additions and 48 deletions

View File

@ -14,13 +14,13 @@ Link partners with mass-mailing
: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/mass_mailing_partner
:target: https://github.com/OCA/social/tree/15.0/mass_mailing_partner
: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-mass_mailing_partner
:target: https://translation.odoo-community.org/projects/social-15-0/social-15-0-mass_mailing_partner
: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|
@ -61,7 +61,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:%20mass_mailing_partner%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:%20mass_mailing_partner%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.
@ -104,6 +104,6 @@ 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/14.0/mass_mailing_partner>`_ project on GitHub.
This module is part of the `OCA/social <https://github.com/OCA/social/tree/15.0/mass_mailing_partner>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -6,7 +6,7 @@
{
"name": "Link partners with mass-mailing",
"version": "14.0.1.0.1",
"version": "15.0.1.0.0",
"author": "Tecnativa, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/social",
"license": "AGPL-3",

View File

@ -13,21 +13,18 @@ _logger = logging.getLogger(__name__)
def post_init_hook(cr, registry):
with api.Environment.manage():
env = api.Environment(cr, SUPERUSER_ID, {})
# ACTION 1: Match existing contacts
contact_model = env["mailing.contact"]
partner_model = env["res.partner"]
contacts = contact_model.search([("email", "!=", False)])
_logger.info("Trying to match %d contacts to partner by email", len(contacts))
for contact in contacts:
partners = partner_model.search(
[("email", "=ilike", contact.email)], limit=1
)
if partners:
contact.write({"partner_id": partners.id})
# ACTION 2: Match existing statistics
stat_model = env["mailing.trace"]
stats = stat_model.search([("model", "!=", False), ("res_id", "!=", False)])
_logger.info("Trying to link %d mass mailing statistics to partner", len(stats))
stats.partner_link()
env = api.Environment(cr, SUPERUSER_ID, {})
# ACTION 1: Match existing contacts
contact_model = env["mailing.contact"]
partner_model = env["res.partner"]
contacts = contact_model.search([("email", "!=", False)])
_logger.info("Trying to match %d contacts to partner by email", len(contacts))
for contact in contacts:
partners = partner_model.search([("email", "=ilike", contact.email)], limit=1)
if partners:
contact.write({"partner_id": partners.id})
# ACTION 2: Match existing statistics
stat_model = env["mailing.trace"]
stats = stat_model.search([("model", "!=", False), ("res_id", "!=", False)])
_logger.info("Trying to link %d mass mailing statistics to partner", len(stats))
stats.partner_link()

View File

@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
@ -57,35 +57,17 @@ msgid "Created on"
msgstr ""
#. module: mass_mailing_partner
#: model:ir.model.fields,field_description:mass_mailing_partner.field_base_partner_merge_automatic_wizard__display_name
#: model:ir.model.fields,field_description:mass_mailing_partner.field_mailing_contact__display_name
#: model:ir.model.fields,field_description:mass_mailing_partner.field_mailing_contact_subscription__display_name
#: model:ir.model.fields,field_description:mass_mailing_partner.field_mailing_list__display_name
#: model:ir.model.fields,field_description:mass_mailing_partner.field_mailing_trace__display_name
#: model:ir.model.fields,field_description:mass_mailing_partner.field_partner_mail_list_wizard__display_name
#: model:ir.model.fields,field_description:mass_mailing_partner.field_res_partner__display_name
msgid "Display Name"
msgstr ""
#. module: mass_mailing_partner
#: model:ir.model.fields,field_description:mass_mailing_partner.field_base_partner_merge_automatic_wizard__id
#: model:ir.model.fields,field_description:mass_mailing_partner.field_mailing_contact__id
#: model:ir.model.fields,field_description:mass_mailing_partner.field_mailing_contact_subscription__id
#: model:ir.model.fields,field_description:mass_mailing_partner.field_mailing_list__id
#: model:ir.model.fields,field_description:mass_mailing_partner.field_mailing_trace__id
#: model:ir.model.fields,field_description:mass_mailing_partner.field_partner_mail_list_wizard__id
#: model:ir.model.fields,field_description:mass_mailing_partner.field_res_partner__id
msgid "ID"
msgstr ""
#. module: mass_mailing_partner
#: model:ir.model.fields,field_description:mass_mailing_partner.field_base_partner_merge_automatic_wizard____last_update
#: model:ir.model.fields,field_description:mass_mailing_partner.field_mailing_contact____last_update
#: model:ir.model.fields,field_description:mass_mailing_partner.field_mailing_contact_subscription____last_update
#: model:ir.model.fields,field_description:mass_mailing_partner.field_mailing_list____last_update
#: model:ir.model.fields,field_description:mass_mailing_partner.field_mailing_trace____last_update
#: model:ir.model.fields,field_description:mass_mailing_partner.field_partner_mail_list_wizard____last_update
#: model:ir.model.fields,field_description:mass_mailing_partner.field_res_partner____last_update
msgid "Last Modified on"
msgstr ""

View File

@ -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="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.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/mass_mailing_partner"><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-mass_mailing_partner"><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="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.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/mass_mailing_partner"><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-mass_mailing_partner"><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 links mass-mailing contacts with partners.</p>
<div class="section" id="features">
<h1>Features</h1>
@ -404,7 +404,7 @@ as mailing list contacts.</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:%20mass_mailing_partner%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:%20mass_mailing_partner%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">
@ -447,7 +447,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/14.0/mass_mailing_partner">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/mass_mailing_partner">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>

View File

@ -9,7 +9,7 @@
<field name="model">mailing.trace</field>
<field name="inherit_id" ref="mass_mailing.mailing_trace_view_form" />
<field name="arch" type="xml">
<field name="res_id" position="after">
<field name="message_id" position="after">
<field name="partner_id" />
</field>
</field>
@ -20,7 +20,7 @@
<field name="model">mailing.trace</field>
<field name="inherit_id" ref="mass_mailing.mailing_trace_view_tree" />
<field name="arch" type="xml">
<field name="sent" position="before">
<field name="sent_datetime" position="before">
<field name="partner_id" />
</field>
</field>