diff --git a/mail_activity_team/README.rst b/mail_activity_team/README.rst new file mode 100644 index 00000000..0c79d92e --- /dev/null +++ b/mail_activity_team/README.rst @@ -0,0 +1,98 @@ +================== +Mail Activity Team +================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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_team + :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_team + :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| + +This module adds the possibility to assign teams to activities. + + + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To set up new teams: + +#. Go to *Settings / Activate developer mode* +#. Go to *Settings / Technical / Email / Activity Teams* +#. Create a new Team and assign (optionally) the models in which it will + be used, and the members of the team. + +You can also assign a user to Activity teams going to +*Settings / Users & Companies / Users*, and in the *Preferences* tab, field +Activity Teams. + +When you create a new activity the application will propose the user's +assigned team. + +You can report on the activities assigned to a team going to +*Dashboards / Activities*, and then filter by a specific team or group by +teams. + +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 +~~~~~~~ + +* Eficent + +Contributors +~~~~~~~~~~~~ + +* `Eficent `_: + + * Jordi Ballester Alomar (jordi.ballester@eficent.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/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_team/__init__.py b/mail_activity_team/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/mail_activity_team/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/mail_activity_team/__manifest__.py b/mail_activity_team/__manifest__.py new file mode 100644 index 00000000..4963644f --- /dev/null +++ b/mail_activity_team/__manifest__.py @@ -0,0 +1,23 @@ +# Copyright 2018 Eficent Business and IT Consulting Services, S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +{ + 'name': 'Mail Activity Team', + 'summary': 'Add Teams to Activities', + 'version': '11.0.1.0.0', + 'development_status': 'Beta', + 'category': 'Social Network', + 'website': 'https://github.com/OCA/social', + 'author': 'Eficent, Odoo Community Association (OCA)', + 'license': 'AGPL-3', + 'installable': True, + 'depends': [ + 'mail_activity_board', + ], + 'data': [ + 'security/ir.model.access.csv', + 'security/mail_activity_team_security.xml', + 'views/mail_activity_team_views.xml', + 'views/mail_activity_views.xml', + 'views/res_users_views.xml', + ], +} diff --git a/mail_activity_team/models/__init__.py b/mail_activity_team/models/__init__.py new file mode 100644 index 00000000..2f37e6cc --- /dev/null +++ b/mail_activity_team/models/__init__.py @@ -0,0 +1,3 @@ +from . import mail_activity_team +from . import mail_activity +from . import res_users diff --git a/mail_activity_team/models/mail_activity.py b/mail_activity_team/models/mail_activity.py new file mode 100644 index 00000000..51cf198f --- /dev/null +++ b/mail_activity_team/models/mail_activity.py @@ -0,0 +1,34 @@ +# Copyright 2018 Eficent Business and IT Consulting Services, S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from odoo import api, models, fields + + +class MailActivity(models.Model): + _inherit = "mail.activity" + + def _get_default_team_id(self): + res_model = self.env.context.get('default_res_model', False) + model = self.env['ir.model'].search([('model', '=', res_model)], + limit=1) + domain = [('member_ids', 'in', [self.env.uid])] + if res_model: + domain.extend(['|', ('res_model_ids', '=', False), + ('res_model_ids', 'in', model.ids)]) + return self.env['mail.activity.team'].search(domain, limit=1) + + team_id = fields.Many2one('mail.activity.team', + default=lambda s: s._get_default_team_id(),) + + @api.onchange('res_model_id', 'user_id') + def _onchange_model_user(self): + res = {'domain': {'team_id': []}} + if self.team_id: + if self.user_id not in self.team_id.member_ids: + self.team_id = False + if self.res_model_id: + res['domain']['team_id'] = [ + ('res_model_ids', 'in', self.res_model_id.ids)] + if self.user_id: + res['domain']['team_id'] = [ + ('member_ids', 'in', self.user_id.ids)] + return res diff --git a/mail_activity_team/models/mail_activity_team.py b/mail_activity_team/models/mail_activity_team.py new file mode 100644 index 00000000..81d0676f --- /dev/null +++ b/mail_activity_team/models/mail_activity_team.py @@ -0,0 +1,14 @@ +# Copyright 2018 Eficent Business and IT Consulting Services, S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from odoo import fields, models + + +class MailActivityTeam(models.Model): + _name = "mail.activity.team" + _description = 'Mail Activity Team' + + name = fields.Char(string='Name', required=True, translate=True) + active = fields.Boolean(string='Active', default=True) + res_model_ids = fields.Many2many('ir.model', string='Used models') + member_ids = fields.Many2many('res.users', 'mail_activity_team_users_rel', + string="Team Members") diff --git a/mail_activity_team/models/res_users.py b/mail_activity_team/models/res_users.py new file mode 100644 index 00000000..b55ae842 --- /dev/null +++ b/mail_activity_team/models/res_users.py @@ -0,0 +1,11 @@ +# Copyright 2018 Eficent Business and IT Consulting Services, S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +from odoo import models, fields + + +class ResUsers(models.Model): + _inherit = "res.users" + + activity_team_ids = fields.Many2many('mail.activity.team', + 'mail_activity_team_users_rel', + string="Activity Teams") diff --git a/mail_activity_team/readme/CONTRIBUTORS.rst b/mail_activity_team/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..3507ebd1 --- /dev/null +++ b/mail_activity_team/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `Eficent `_: + + * Jordi Ballester Alomar (jordi.ballester@eficent.com) diff --git a/mail_activity_team/readme/DESCRIPTION.rst b/mail_activity_team/readme/DESCRIPTION.rst new file mode 100644 index 00000000..c0a2e3ae --- /dev/null +++ b/mail_activity_team/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module adds the possibility to assign teams to activities. + + diff --git a/mail_activity_team/readme/USAGE.rst b/mail_activity_team/readme/USAGE.rst new file mode 100644 index 00000000..a9b4344f --- /dev/null +++ b/mail_activity_team/readme/USAGE.rst @@ -0,0 +1,17 @@ +To set up new teams: + +#. Go to *Settings / Activate developer mode* +#. Go to *Settings / Technical / Email / Activity Teams* +#. Create a new Team and assign (optionally) the models in which it will + be used, and the members of the team. + +You can also assign a user to Activity teams going to +*Settings / Users & Companies / Users*, and in the *Preferences* tab, field +Activity Teams. + +When you create a new activity the application will propose the user's +assigned team. + +You can report on the activities assigned to a team going to +*Dashboards / Activities*, and then filter by a specific team or group by +teams. diff --git a/mail_activity_team/security/ir.model.access.csv b/mail_activity_team/security/ir.model.access.csv new file mode 100644 index 00000000..c5efccfc --- /dev/null +++ b/mail_activity_team/security/ir.model.access.csv @@ -0,0 +1,4 @@ +"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" +access_mail_activity_team_all,mail.activity.team.all,model_mail_activity_team,,1,0,0,0 +access_mail_activity_team_user,mail.activity.team.user,model_mail_activity_team,base.group_user,1,1,0,0 +access_mail_activity_team_system_user,mail.activity.team.system.user,model_mail_activity_team,base.group_system_user,1,1,1,1 diff --git a/mail_activity_team/security/mail_activity_team_security.xml b/mail_activity_team/security/mail_activity_team_security.xml new file mode 100644 index 00000000..9ac63631 --- /dev/null +++ b/mail_activity_team/security/mail_activity_team_security.xml @@ -0,0 +1,15 @@ + + + + + mail.activity: user: my team + + ['|', '&'('team_id', '=', False),('user_id', '=', user.id),('team_id', '=', user.team_ids.ids)] + + + + + + + + diff --git a/mail_activity_team/static/description/icon.png b/mail_activity_team/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/mail_activity_team/static/description/icon.png differ diff --git a/mail_activity_team/static/description/index.html b/mail_activity_team/static/description/index.html new file mode 100644 index 00000000..8862473c --- /dev/null +++ b/mail_activity_team/static/description/index.html @@ -0,0 +1,419 @@ + + + + + + +Mail Activity Team + + + +
+

Mail Activity Team

+ + +

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

+

This module adds the possibility to assign teams to activities.

+

Table of contents

+ +
+

Usage

+

To set up new teams:

+
    +
  1. Go to Settings / Activate developer mode
  2. +
  3. Go to Settings / Technical / Email / Activity Teams
  4. +
  5. Create a new Team and assign (optionally) the models in which it will +be used, and the members of the team.
  6. +
+

You can also assign a user to Activity teams going to +Settings / Users & Companies / Users, and in the Preferences tab, field +Activity Teams.

+

When you create a new activity the application will propose the user’s +assigned team.

+

You can report on the activities assigned to a team going to +Dashboards / Activities, and then filter by a specific team or group by +teams.

+
+
+

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

+
    +
  • Eficent
  • +
+
+
+

Contributors

+ +
+
+

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_team/views/mail_activity_team_views.xml b/mail_activity_team/views/mail_activity_team_views.xml new file mode 100644 index 00000000..52203d2d --- /dev/null +++ b/mail_activity_team/views/mail_activity_team_views.xml @@ -0,0 +1,90 @@ + + + + + + + + mail.activity.team.view.form + mail.activity.team + +
+ +
+ +
+ + + + + + + + + + + + + +
+
+
+
+ + + + + mail.activity.team.view.tree + mail.activity.team + + + + + + + + + + + + mail.activity.team.view.search + mail.activity.team + + + + + + + + + + + + + Activity Teams + mail.activity.team + form + tree,form + [] + {} + + + + + + + +
diff --git a/mail_activity_team/views/mail_activity_views.xml b/mail_activity_team/views/mail_activity_views.xml new file mode 100644 index 00000000..93ad71b9 --- /dev/null +++ b/mail_activity_team/views/mail_activity_views.xml @@ -0,0 +1,70 @@ + + + + + mail.activity.view.form.popup + mail.activity + + + + + + + + + + mail.activity.view.tree + mail.activity + + + + + + + + + + mail.activity.view.form + mail.activity + + + + + + + + + + mail.activity.boards.view.kanban + mail.activity + + + + + + +
+
+ Team: +
+
+
+
+ + + + mail.activity.boards.view.search + mail.activity + + + + + + + + + + + + +
diff --git a/mail_activity_team/views/res_users_views.xml b/mail_activity_team/views/res_users_views.xml new file mode 100644 index 00000000..bf79365e --- /dev/null +++ b/mail_activity_team/views/res_users_views.xml @@ -0,0 +1,16 @@ + + + + + res.users.form.activity.team + res.users + + + + + + + + + +