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, +)