Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIG] mail_activity_partner: Migration to 18.0 #13

Closed
Closed
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fe87e57
[12.0][ADD] Add module mail_activity_partner
AdriaGForgeFlow Dec 21, 2018
7be3e36
[UPD] README.rst
OCA-git-bot Jan 15, 2019
23fd116
[UPD] Update mail_activity_partner.pot
oca-travis Jan 15, 2019
60e6664
[ADD] icon.png
OCA-git-bot Apr 3, 2019
6fae80f
[UPD] README.rst
OCA-git-bot Jul 29, 2019
559b115
[IMP] mail_activity_partner: black, isort
AdriaGForgeFlow Dec 24, 2019
b8587da
[MIG] mail_activity_partner: Migration to 13.0
AdriaGForgeFlow Dec 24, 2019
c77549b
[UPD] Update mail_activity_partner.pot
oca-travis Jan 7, 2021
57da497
[IMP] pre-commit run -a
Jan 26, 2021
e14006a
[MIG] mail_activity_partner: Migration to 14.0
Rad0van Nov 10, 2021
a1ddd47
[UPD] Update mail_activity_partner.pot
oca-travis Nov 27, 2021
25a5d73
[UPD] README.rst
OCA-git-bot Nov 27, 2021
46f5085
[15.0][MIG] mail_activity_partner: Migration to 15.0
JoanMForgeFlow Nov 30, 2021
5356261
[UPD] Update mail_activity_partner.pot
Dec 6, 2021
6502c98
[UPD] README.rst
OCA-git-bot Dec 6, 2021
33b39e1
[FIX] mail_activity_partner: Remove test folder from __init__
victoralmau Nov 3, 2022
5200ea5
[MIG] mail_activity_partner: Migration to 16.0
polqubiq Jun 6, 2023
e71bdf6
[UPD] Update mail_activity_partner.pot
Nov 17, 2023
b9e58a2
[BOT] post-merge updates
OCA-git-bot Nov 17, 2023
1c2ea48
Added translation using Weblate (Italian)
mymage Nov 30, 2023
70081f2
Translated using Weblate (Italian)
mymage Dec 1, 2023
ae6adad
Added translation using Weblate (Spanish)
Ivorra78 Dec 12, 2023
a253810
Translated using Weblate (Spanish)
Ivorra78 Dec 12, 2023
c50d1a6
[18.0-mig-mail] [MIG] mail_activity_partner: Migration to 18.0
carlosdynapps Nov 21, 2024
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
82 changes: 82 additions & 0 deletions mail_activity_partner/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
=====================
Mail Activity Partner
=====================

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

.. |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%2Fmail-lightgray.png?logo=github
:target: https://github.com/OCA/mail/tree/18.0/mail_activity_partner
:alt: OCA/mail
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/mail-18-0/mail-18-0-mail_activity_partner
: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/mail&target_branch=18.0
:alt: Try me on Runboat

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

This module adds a partner and commercial partner field to activities

**Table of contents**

.. contents::
:local:

Usage
=====



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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/mail/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/mail/issues/new?body=module:%20mail_activity_partner%0Aversion:%2018.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

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

- Adrià Gil Sorribes (adria.gil@forgeflow.com)
- Joan Mateu Jordi (joan.mateu@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/mail <https://github.com/OCA/mail/tree/18.0/mail_activity_partner>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions mail_activity_partner/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import models
15 changes: 15 additions & 0 deletions mail_activity_partner/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2018 ForgeFlow S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Mail Activity Partner",
"summary": "Add Partner to Activities",
"version": "18.0.1.0.0",
"development_status": "Beta",
"category": "Social Network",
"website": "https://github.com/OCA/mail",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"data": ["views/mail_activity_views.xml"],
"depends": ["mail_activity_board"],
}
32 changes: 32 additions & 0 deletions mail_activity_partner/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_activity_partner
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-12-12 16:22+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\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.17\n"

#. module: mail_activity_partner
#: model:ir.model,name:mail_activity_partner.model_mail_activity
msgid "Activity"
msgstr "Actividad"

#. module: mail_activity_partner
#: model:ir.model.fields,field_description:mail_activity_partner.field_mail_activity__commercial_partner_id
msgid "Commercial Entity"
msgstr "Entidad Comercial"

#. module: mail_activity_partner
#: model:ir.model.fields,field_description:mail_activity_partner.field_mail_activity__partner_id
msgid "Partner"
msgstr "Proveedor"
32 changes: 32 additions & 0 deletions mail_activity_partner/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_activity_partner
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-12-01 10:12+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 4.17\n"

#. module: mail_activity_partner
#: model:ir.model,name:mail_activity_partner.model_mail_activity
msgid "Activity"
msgstr "Attività"

#. module: mail_activity_partner
#: model:ir.model.fields,field_description:mail_activity_partner.field_mail_activity__commercial_partner_id
msgid "Commercial Entity"
msgstr "Entità commerciale"

#. module: mail_activity_partner
#: model:ir.model.fields,field_description:mail_activity_partner.field_mail_activity__partner_id
msgid "Partner"
msgstr "Partner"
29 changes: 29 additions & 0 deletions mail_activity_partner/i18n/mail_activity_partner.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_activity_partner
#
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: mail_activity_partner
#: model:ir.model,name:mail_activity_partner.model_mail_activity
msgid "Activity"
msgstr ""

#. module: mail_activity_partner
#: model:ir.model.fields,field_description:mail_activity_partner.field_mail_activity__commercial_partner_id
msgid "Commercial Entity"
msgstr ""

#. module: mail_activity_partner
#: model:ir.model.fields,field_description:mail_activity_partner.field_mail_activity__partner_id
msgid "Partner"
msgstr ""
3 changes: 3 additions & 0 deletions mail_activity_partner/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import mail_activity
38 changes: 38 additions & 0 deletions mail_activity_partner/models/mail_activity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2018 ForgeFlow S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models


class MailActivity(models.Model):
_inherit = "mail.activity"

partner_id = fields.Many2one(
comodel_name="res.partner",
index=True,
compute="_compute_res_partner_id",
store=True,
)

commercial_partner_id = fields.Many2one(
related="partner_id.commercial_partner_id",
string="Commercial Entity",
store=True,
related_sudo=True,
readonly=True,
)

@api.depends("res_model", "res_id")
def _compute_res_partner_id(self):
for activity in self:
res_model = activity.res_model
res_id = activity.res_id
activity.partner_id = False
if res_model:
if res_model == "res.partner":
activity.partner_id = res_id
else:
res_model_id = self.env[res_model].browse(res_id)
if "partner_id" in res_model_id._fields and res_model_id.partner_id:
activity.partner_id = res_model_id.partner_id
else:
activity.partner_id = False
3 changes: 3 additions & 0 deletions mail_activity_partner/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 mail_activity_partner/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Adrià Gil Sorribes (<adria.gil@forgeflow.com>)
- Joan Mateu Jordi (<joan.mateu@forgeflow.com>)
1 change: 1 addition & 0 deletions mail_activity_partner/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module adds a partner and commercial partner field to activities
1 change: 1 addition & 0 deletions mail_activity_partner/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Binary file added mail_activity_partner/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
428 changes: 428 additions & 0 deletions mail_activity_partner/static/description/index.html

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions mail_activity_partner/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import test_mail_activity_partner
107 changes: 107 additions & 0 deletions mail_activity_partner/tests/test_mail_activity_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Copyright 2018 ForgeFlow S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import TransactionCase


class TestMailActivityPartner(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
# disable tracking test suite wise
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
cls.user_model = cls.env["res.users"].with_context(no_reset_password=True)

cls.user_admin = cls.env.ref("base.user_root")

cls.employee = cls.env["res.users"].create(
{
"company_id": cls.env.ref("base.main_company").id,
"name": "Employee",
"login": "csu",
"email": "crmuser@yourcompany.com",
"groups_id": [
(
6,
0,
[
cls.env.ref("base.group_user").id,
cls.env.ref("base.group_partner_manager").id,
],
)
],
}
)

cls.partner_model = cls.env["ir.model"]._get("res.partner")

activity_type_model = cls.env["mail.activity.type"]
cls.activity1 = activity_type_model.create(
{
"name": "Initial Contact",
"delay_count": 5,
"delay_unit": "days",
"summary": "ACT 1 : Presentation, barbecue, ... ",
"res_model": cls.partner_model.model,
}
)
cls.activity2 = activity_type_model.create(
{
"name": "Call for Demo",
"delay_count": 6,
"summary": "ACT 2 : I want to show you my ERP !",
"res_model": cls.partner_model.model,
}
)

cls.partner_01 = cls.env.ref("base.res_partner_1")

cls.homer = cls.env["res.partner"].create(
{
"name": "Homer Simpson",
"city": "Springfield",
"street": "742 Evergreen Terrace",
"street2": "Donut Lane",
}
)

# test synchro of street3 on create
cls.partner_10 = cls.env["res.partner"].create(
{"name": "Bart Simpson", "parent_id": cls.homer.id, "type": "contact"}
)

def test_partner_for_activity(self):
self.act1 = (
self.env["mail.activity"]
.sudo()
.create(
{
"activity_type_id": self.activity1.id,
"note": "Partner activity 1.",
"res_id": self.partner_01.id,
"res_model_id": self.partner_model.id,
"user_id": self.user_admin.id,
}
)
)

self.act2 = (
self.env["mail.activity"]
.with_user(self.employee)
.create(
{
"activity_type_id": self.activity2.id,
"note": "Partner activity 10.",
"res_id": self.partner_10.id,
"res_model_id": self.partner_model.id,
"user_id": self.employee.id,
}
)
)

# Check partner_id of created activities
self.assertEqual(self.act1.partner_id, self.partner_01)
self.assertEqual(self.act2.partner_id, self.partner_10)

# Check commercial_partner_id for created activities
self.assertEqual(self.act1.commercial_partner_id, self.partner_01)
self.assertEqual(self.act2.commercial_partner_id, self.homer)
60 changes: 60 additions & 0 deletions mail_activity_partner/views/mail_activity_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!--
VIEWS
-->

<!-- FORM VIEW -->
<record id="mail_activity_view_form_board" model="ir.ui.view">
<field name="name">mail.activity.boards.view.form</field>
<field name="model">mail.activity</field>
<field
name="inherit_id"
ref="mail_activity_board.mail_activity_view_form_board"
/>
<field name="arch" type="xml">
<field name="activity_type_id" position="before">
<field name="partner_id" readonly="True" />
<field name="commercial_partner_id" />
</field>
</field>
</record>

<!-- TREE VIEW -->
<record id="mail_activity_view_tree" model="ir.ui.view">
<field name="name">mail.activity.boards.view.tree</field>
<field name="model">mail.activity</field>
<field name="inherit_id" ref="mail_activity_board.mail_activity_view_tree" />
<field name="arch" type="xml">
<field name="activity_type_id" position="before">
<field name="partner_id" readonly="True" />
<field name="commercial_partner_id" />
</field>
</field>
</record>

<!-- KANBAN VIEW -->
<record id="mail_activity_view_kanban" model="ir.ui.view">
<field name="name">mail.activity.boards.view.kanban</field>
<field name="model">mail.activity</field>
<field name="inherit_id" ref="mail_activity_board.mail_activity_view_kanban" />
<field name="arch" type="xml">
<strong class="o_kanban_record_title" position="inside">
<field name="partner_id" />
</strong>
</field>
</record>

<!-- SEARCH VIEW -->
<record id="mail_activity_view_search" model="ir.ui.view">
<field name="name">mail.activity.boards.view.search</field>
<field name="model">mail.activity</field>
<field name="inherit_id" ref="mail_activity_board.mail_activity_view_search" />
<field name="arch" type="xml">
<xpath expr='//field[@name="res_model"]' position='before'>
<field name="partner_id" />
<field name="commercial_partner_id" />
</xpath>
</field>
</record>
</odoo>