diff --git a/mail_activity_creator/README.rst b/mail_activity_creator/README.rst new file mode 100644 index 0000000..0041128 --- /dev/null +++ b/mail_activity_creator/README.rst @@ -0,0 +1,74 @@ +===================== +Mail Activity Creator +===================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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/11.0/mail_activity_creator + :alt: OCA/social +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/social-11-0/social-11-0-mail_activity_creator + :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/11.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Very simple module to show who is the creator of activities since it is +missing in Odoo core. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Creu Blanca + +Contributors +~~~~~~~~~~~~ + +* Jaime Arroyo + +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 `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_activity_creator/__init__.py b/mail_activity_creator/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/mail_activity_creator/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/mail_activity_creator/__manifest__.py b/mail_activity_creator/__manifest__.py new file mode 100644 index 0000000..e6f0750 --- /dev/null +++ b/mail_activity_creator/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2020 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'Mail Activity Creator', + 'summary': """ + Show activities creator""", + 'version': '11.0.1.0.0', + 'license': 'AGPL-3', + 'author': 'Creu Blanca,Odoo Community Association (OCA)', + 'website': 'https://github.com/OCA/social', + 'depends': [ + 'mail' + ], + 'data': [ + 'views/mail_activity_views.xml', + ], + 'qweb': [ + 'static/src/xml/activity.xml', + ], +} diff --git a/mail_activity_creator/models/__init__.py b/mail_activity_creator/models/__init__.py new file mode 100644 index 0000000..1ff3880 --- /dev/null +++ b/mail_activity_creator/models/__init__.py @@ -0,0 +1 @@ +from . import mail_activity diff --git a/mail_activity_creator/models/mail_activity.py b/mail_activity_creator/models/mail_activity.py new file mode 100644 index 0000000..2ed9e13 --- /dev/null +++ b/mail_activity_creator/models/mail_activity.py @@ -0,0 +1,15 @@ +# Copyright 2020 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class MailActivity(models.Model): + + _inherit = 'mail.activity' + + creator_uid = fields.Many2one( + 'res.users', + default=lambda r: r.env.user.id, + string="Creator", + ) diff --git a/mail_activity_creator/readme/CONTRIBUTORS.rst b/mail_activity_creator/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000..e59d510 --- /dev/null +++ b/mail_activity_creator/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Jaime Arroyo diff --git a/mail_activity_creator/readme/DESCRIPTION.rst b/mail_activity_creator/readme/DESCRIPTION.rst new file mode 100644 index 0000000..f1da863 --- /dev/null +++ b/mail_activity_creator/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +Very simple module to show who is the creator of activities since it is +missing in Odoo core. diff --git a/mail_activity_creator/static/description/icon.png b/mail_activity_creator/static/description/icon.png new file mode 100644 index 0000000..3a0328b Binary files /dev/null and b/mail_activity_creator/static/description/icon.png differ diff --git a/mail_activity_creator/static/description/index.html b/mail_activity_creator/static/description/index.html new file mode 100644 index 0000000..fbd9a1a --- /dev/null +++ b/mail_activity_creator/static/description/index.html @@ -0,0 +1,420 @@ + + + + + + +Mail Activity Creator + + + +
+

Mail Activity Creator

+ + +

Beta License: AGPL-3 OCA/social Translate me on Weblate Try me on Runbot

+

Very simple module to show who is the creator of activities since it is +missing in Odoo core.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Creu Blanca
  • +
+
+ +
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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 project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/mail_activity_creator/static/src/xml/activity.xml b/mail_activity_creator/static/src/xml/activity.xml new file mode 100644 index 0000000..fabef43 --- /dev/null +++ b/mail_activity_creator/static/src/xml/activity.xml @@ -0,0 +1,13 @@ + + + + +
Creator
+
+ + +
+
+
+
diff --git a/mail_activity_creator/tests/__init__.py b/mail_activity_creator/tests/__init__.py new file mode 100644 index 0000000..080898d --- /dev/null +++ b/mail_activity_creator/tests/__init__.py @@ -0,0 +1 @@ +from . import test_creator diff --git a/mail_activity_creator/tests/test_creator.py b/mail_activity_creator/tests/test_creator.py new file mode 100644 index 0000000..6fddb61 --- /dev/null +++ b/mail_activity_creator/tests/test_creator.py @@ -0,0 +1,38 @@ +# Copyright 2020 Creu Blanca +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase +from odoo.models import SUPERUSER_ID + + +class TestCreator(TransactionCase): + + def setUp(self): + super().setUp() + self.partner = self.env['res.partner'].create({ + 'name': 'DEMO' + }) + self.user_01 = self.env['res.users'].create({ + 'name': 'user_01', + 'login': 'demo_user_01', + 'email': 'demo@demo.de', + 'notification_type': 'inbox', + }) + self.model_id = self.env['ir.model']._get('res.partner').id + self.activity_type = self.env['mail.activity.type'].create({ + 'name': 'Initial Contact', + 'days': 5, + 'summary': 'ACT 1 : Presentation, barbecue, ... ', + 'res_model_id': self.model_id, + }) + + def test_activity_creator(self): + activity = self.env['mail.activity'].sudo(self.user_01.id).create({ + 'activity_type_id': self.activity_type.id, + 'note': 'Partner activity 3.', + 'res_id': self.partner.id, + 'res_model_id': self.model_id, + 'user_id': self.user_01.id + }) + self.assertEqual(activity.creator_uid, self.user_01) + self.assertEqual(activity.create_uid.id, SUPERUSER_ID) diff --git a/mail_activity_creator/views/mail_activity_views.xml b/mail_activity_creator/views/mail_activity_views.xml new file mode 100644 index 0000000..9c93a64 --- /dev/null +++ b/mail_activity_creator/views/mail_activity_views.xml @@ -0,0 +1,13 @@ + + + + mail.activity.form.activity + mail.activity + + + + + + + +