From 5e4a6324d1263d88e09031be3cf93ecad0aae6c7 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Tue, 29 Nov 2022 21:21:51 +0100 Subject: [PATCH] [ADD] project_multi_company module --- project_multi_company/README.rst | 0 project_multi_company/__init__.py | 1 + project_multi_company/__manifest__.py | 21 ++++++++++++ project_multi_company/i18n/fr.po | 33 +++++++++++++++++++ project_multi_company/models/__init__.py | 2 ++ project_multi_company/models/project_tags.py | 19 +++++++++++ .../models/project_task_type.py | 19 +++++++++++ project_multi_company/readme/CONTRIBUTORS.rst | 1 + project_multi_company/readme/DESCRIPTION.rst | 4 +++ project_multi_company/security/ir_rule.xml | 17 ++++++++++ .../views/view_project_tags.xml | 30 +++++++++++++++++ .../views/view_project_task_type.xml | 30 +++++++++++++++++ .../odoo/addons/project_multi_company | 1 + setup/project_multi_company/setup.py | 6 ++++ 14 files changed, 184 insertions(+) create mode 100644 project_multi_company/README.rst create mode 100644 project_multi_company/__init__.py create mode 100644 project_multi_company/__manifest__.py create mode 100644 project_multi_company/i18n/fr.po create mode 100644 project_multi_company/models/__init__.py create mode 100644 project_multi_company/models/project_tags.py create mode 100644 project_multi_company/models/project_task_type.py create mode 100644 project_multi_company/readme/CONTRIBUTORS.rst create mode 100644 project_multi_company/readme/DESCRIPTION.rst create mode 100644 project_multi_company/security/ir_rule.xml create mode 100644 project_multi_company/views/view_project_tags.xml create mode 100644 project_multi_company/views/view_project_task_type.xml create mode 120000 setup/project_multi_company/odoo/addons/project_multi_company create mode 100644 setup/project_multi_company/setup.py diff --git a/project_multi_company/README.rst b/project_multi_company/README.rst new file mode 100644 index 00000000000..e69de29bb2d diff --git a/project_multi_company/__init__.py b/project_multi_company/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/project_multi_company/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/project_multi_company/__manifest__.py b/project_multi_company/__manifest__.py new file mode 100644 index 00000000000..ff507504973 --- /dev/null +++ b/project_multi_company/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright (C) 2021 - Today: GRAP (http://www.grap.coop) +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Project - Multi Company", + "summary": """ + This module adds support for multi company on Project Module.""", + "version": "12.0.1.0.0", + "license": "AGPL-3", + "author": "GRAP, Odoo Community Association (OCA)", + "maintainers": ["legalsylvain"], + "website": "https://github.com/OCA/multi-company", + "installable": True, + "depends": ["project"], + "data": [ + "security/ir_rule.xml", + "views/view_project_tags.xml", + "views/view_project_task_type.xml", + ], +} diff --git a/project_multi_company/i18n/fr.po b/project_multi_company/i18n/fr.po new file mode 100644 index 00000000000..13d739f7557 --- /dev/null +++ b/project_multi_company/i18n/fr.po @@ -0,0 +1,33 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * project_multi_company +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-28 14:23+0000\n" +"PO-Revision-Date: 2024-09-28 14:23+0000\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: project_multi_company +#: model:ir.model.fields,field_description:project_multi_company.field_project_tags__company_id +#: model:ir.model.fields,field_description:project_multi_company.field_project_task_type__company_id +msgid "Company" +msgstr "Société" + +#. module: project_multi_company +#: model:ir.model,name:project_multi_company.model_project_tags +msgid "Project Tags" +msgstr "Étiquettes de projet" + +#. module: project_multi_company +#: model:ir.model,name:project_multi_company.model_project_task_type +msgid "Task Stage" +msgstr "Étape de tâche" + diff --git a/project_multi_company/models/__init__.py b/project_multi_company/models/__init__.py new file mode 100644 index 00000000000..345a7c5a8e3 --- /dev/null +++ b/project_multi_company/models/__init__.py @@ -0,0 +1,2 @@ +from . import project_tags +from . import project_task_type diff --git a/project_multi_company/models/project_tags.py b/project_multi_company/models/project_tags.py new file mode 100644 index 00000000000..ed1f605537c --- /dev/null +++ b/project_multi_company/models/project_tags.py @@ -0,0 +1,19 @@ +# Copyright (C) 2021 - Today: GRAP (http://www.grap.coop) +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ProjectTags(models.Model): + _inherit = "project.tags" + + company_id = fields.Many2one( + "res.company", + string="Company", + index=True, + default=lambda self: self._default_company_id(), + ) + + def _default_company_id(self): + return self.env.user.company_id diff --git a/project_multi_company/models/project_task_type.py b/project_multi_company/models/project_task_type.py new file mode 100644 index 00000000000..a28bfaaf302 --- /dev/null +++ b/project_multi_company/models/project_task_type.py @@ -0,0 +1,19 @@ +# Copyright (C) 2021 - Today: GRAP (http://www.grap.coop) +# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ProjectTaskType(models.Model): + _inherit = "project.task.type" + + company_id = fields.Many2one( + "res.company", + string="Company", + index=True, + default=lambda self: self._default_company_id(), + ) + + def _default_company_id(self): + return self.env.user.company_id diff --git a/project_multi_company/readme/CONTRIBUTORS.rst b/project_multi_company/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..9f76a75bc18 --- /dev/null +++ b/project_multi_company/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Sylvain LE GAL diff --git a/project_multi_company/readme/DESCRIPTION.rst b/project_multi_company/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..17ea55113ec --- /dev/null +++ b/project_multi_company/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +This module adds support for multi company on Project module. +It adds ``company_id`` on the following models : +- ``project.task.type`` (Stages) +- ``project.tags`` (Tags) \ No newline at end of file diff --git a/project_multi_company/security/ir_rule.xml b/project_multi_company/security/ir_rule.xml new file mode 100644 index 00000000000..385c6a96bd8 --- /dev/null +++ b/project_multi_company/security/ir_rule.xml @@ -0,0 +1,17 @@ + + + + + + Project Tags - Multi-Company + + ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + + + + Project Stages - Multi-Company + + ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + + + diff --git a/project_multi_company/views/view_project_tags.xml b/project_multi_company/views/view_project_tags.xml new file mode 100644 index 00000000000..2d18940fa22 --- /dev/null +++ b/project_multi_company/views/view_project_tags.xml @@ -0,0 +1,30 @@ + + + + + + + project.tags + + + + + + + + + + project.tags + + + + + + + + + diff --git a/project_multi_company/views/view_project_task_type.xml b/project_multi_company/views/view_project_task_type.xml new file mode 100644 index 00000000000..ae31f268a0e --- /dev/null +++ b/project_multi_company/views/view_project_task_type.xml @@ -0,0 +1,30 @@ + + + + + + + project.task.type + + + + + + + + + + project.task.type + + + + + + + + + diff --git a/setup/project_multi_company/odoo/addons/project_multi_company b/setup/project_multi_company/odoo/addons/project_multi_company new file mode 120000 index 00000000000..577fef3948a --- /dev/null +++ b/setup/project_multi_company/odoo/addons/project_multi_company @@ -0,0 +1 @@ +../../../../project_multi_company \ No newline at end of file diff --git a/setup/project_multi_company/setup.py b/setup/project_multi_company/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/project_multi_company/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)