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

[16.0][mig] mail_activity_partner #1170

Closed
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
74 changes: 74 additions & 0 deletions mail_activity_partner/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
=====================
Mail Activity Partner
=====================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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%2Fsocial-lightgray.png?logo=github
:target: https://github.com/OCA/social/tree/15.0/mail_activity_partner
:alt: OCA/social
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/social-15-0/social-15-0-mail_activity_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/15.0
:alt: Try me on Runbot

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

This module adds a partner and commercial partner field to activities

**Table of contents**

.. contents::
:local:

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_activity_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.

Credits
=======

Authors
~~~~~~~

* ForgeFlow

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

* Adrià Gil Sorribes ([email protected])
* Joan Mateu Jordi ([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.

This module is part of the `OCA/social <https://github.com/OCA/social/tree/15.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": "16.0.1.0.0",
"development_status": "Beta",
"category": "Social Network",
"website": "https://github.com/OCA/social",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"data": ["views/mail_activity_views.xml"],
"depends": ["mail_activity_board"],
}
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 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_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)

Check warning on line 34 in mail_activity_partner/models/mail_activity.py

View check run for this annotation

Codecov / codecov/patch

mail_activity_partner/models/mail_activity.py#L34

Added line #L34 was not covered by tests
if "partner_id" in res_model_id._fields and res_model_id.partner_id:
activity.partner_id = res_model_id.partner_id

Check warning on line 36 in mail_activity_partner/models/mail_activity.py

View check run for this annotation

Codecov / codecov/patch

mail_activity_partner/models/mail_activity.py#L36

Added line #L36 was not covered by tests
else:
activity.partner_id = False

Check warning on line 38 in mail_activity_partner/models/mail_activity.py

View check run for this annotation

Codecov / codecov/patch

mail_activity_partner/models/mail_activity.py#L38

Added line #L38 was not covered by tests
2 changes: 2 additions & 0 deletions mail_activity_partner/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Adrià Gil Sorribes ([email protected])
* Joan Mateu Jordi ([email protected])
1 change: 1 addition & 0 deletions mail_activity_partner/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module adds a partner and commercial partner field to activities
Empty file.
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.
Loading
Loading