Skip to content

Commit

Permalink
Merge PR #702 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by legalsylvain
  • Loading branch information
OCA-git-bot committed Oct 20, 2024
2 parents 37ddb30 + 5e4a632 commit ce2b284
Show file tree
Hide file tree
Showing 14 changed files with 184 additions and 0 deletions.
Empty file.
1 change: 1 addition & 0 deletions project_multi_company/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
21 changes: 21 additions & 0 deletions project_multi_company/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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",
],
}
33 changes: 33 additions & 0 deletions project_multi_company/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -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"

2 changes: 2 additions & 0 deletions project_multi_company/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import project_tags
from . import project_task_type
19 changes: 19 additions & 0 deletions project_multi_company/models/project_tags.py
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions project_multi_company/models/project_task_type.py
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions project_multi_company/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Sylvain LE GAL <https://twitter.com/legalsylvain>
4 changes: 4 additions & 0 deletions project_multi_company/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -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)
17 changes: 17 additions & 0 deletions project_multi_company/security/ir_rule.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>

<odoo noupdate="1">

<record id="project_tags_company_rule" model="ir.rule">
<field name="name">Project Tags - Multi-Company</field>
<field name="model_id" ref="project.model_project_tags"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>

<record id="project_task_type_company_rule" model="ir.rule">
<field name="name">Project Stages - Multi-Company</field>
<field name="model_id" ref="project.model_project_task_type"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>

</odoo>
30 changes: 30 additions & 0 deletions project_multi_company/views/view_project_tags.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
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).
-->

<odoo>

<record id="view_project_tags_tree" model="ir.ui.view">
<field name="model">project.tags</field>
<field name="arch" type="xml">
<tree>
<field name="name" />
<field name="company_id" groups="base.group_multi_company"/>
</tree>
</field>
</record>

<record id="view_project_tags_form" model="ir.ui.view">
<field name="model">project.tags</field>
<field name="inherit_id" ref="project.project_tags_form_view"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="company_id" groups="base.group_multi_company"/>
</field>
</field>
</record>

</odoo>
30 changes: 30 additions & 0 deletions project_multi_company/views/view_project_task_type.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
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).
-->

<odoo>

<record id="view_project_task_type_tree" model="ir.ui.view">
<field name="model">project.task.type</field>
<field name="inherit_id" ref="project.task_type_tree"/>
<field name="arch" type="xml">
<field name="description" position="after">
<field name="company_id" groups="base.group_multi_company"/>
</field>
</field>
</record>

<record id="view_project_task_type_form" model="ir.ui.view">
<field name="model">project.task.type</field>
<field name="inherit_id" ref="project.task_type_edit"/>
<field name="arch" type="xml">
<field name="mail_template_id" position="after">
<field name="company_id" groups="base.group_multi_company"/>
</field>
</field>
</record>

</odoo>
6 changes: 6 additions & 0 deletions setup/project_multi_company/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit ce2b284

Please sign in to comment.