Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions crm_stage_multi_company/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=======================
Crm Stage Multi Company
=======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:3913be899b0dac056dafd3c26a50291b10216123ef328ad4a854f1602e4a9d5b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/license-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%2Fmulti--company-lightgray.png?logo=github
:target: https://github.com/OCA/multi-company/tree/19.0/crm_stage_multi_company
:alt: OCA/multi-company
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/multi-company-19-0/multi-company-19-0-crm_stage_multi_company
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/multi-company&target_branch=19.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds support for multi company on crm stage.

The new multi company rule prevents any user without access to all
stages to open the CRM application. This behaviour comes from the kanban
view and especially from he read_group (\_read_group_fill_results) which
tries to retrieve fold information from the stages even those without
any lead. So to only do this on accessible stages a search is made by
the current user over the stage ids returned by the group_expand method
which is initially launched through a sudo.

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/multi-company/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/multi-company/issues/new?body=module:%20crm_stage_multi_company%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* ACS0NE SA/NV

Contributors
------------

- Quentin Groulard <quentin.groulard@acsone.eu>
(`ACSONE <https://acsone.eu/>`__)

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/multi-company <https://github.com/OCA/multi-company/tree/19.0/crm_stage_multi_company>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions crm_stage_multi_company/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
17 changes: 17 additions & 0 deletions crm_stage_multi_company/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2019 ACS0NE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Crm Stage Multi Company",
"summary": """
This module adds support for multi company on crm stage.""",
"version": "19.0.1.0.0",
"license": "AGPL-3",
"author": "ACS0NE SA/NV, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/multi-company",
"application": False,
"installable": True,
"depends": ["crm"],
"data": ["views/crm_stage.xml", "security/crm_security.xml"],
"demo": [],
}
41 changes: 41 additions & 0 deletions crm_stage_multi_company/i18n/crm_stage_multi_company.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_stage_multi_company
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.0\n"
"Report-Msgid-Bugs-To: \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: crm_stage_multi_company
#: model:ir.model,name:crm_stage_multi_company.model_crm_stage
msgid "CRM Stages"
msgstr ""

#. module: crm_stage_multi_company
#: model:ir.model.fields,field_description:crm_stage_multi_company.field_crm_stage__company_id
msgid "Company"
msgstr ""

#. module: crm_stage_multi_company
#: model:ir.model,name:crm_stage_multi_company.model_crm_lead
msgid "Lead/Opportunity"
msgstr ""

#. module: crm_stage_multi_company
#: model:ir.model.fields,help:crm_stage_multi_company.field_crm_stage__company_id
msgid ""
"Specific company that uses this stage. Other companies will not be able to "
"see or use this stage."
msgstr ""

#. module: crm_stage_multi_company
#: model:ir.model.fields,field_description:crm_stage_multi_company.field_crm_lead__stage_id
msgid "Stage"
msgstr ""
46 changes: 46 additions & 0 deletions crm_stage_multi_company/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * crm_stage_multi_company
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2025-02-24 15:06+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.6.2\n"

#. module: crm_stage_multi_company
#: model:ir.model,name:crm_stage_multi_company.model_crm_stage
msgid "CRM Stages"
msgstr "Fasi CRM"

#. module: crm_stage_multi_company
#: model:ir.model.fields,field_description:crm_stage_multi_company.field_crm_stage__company_id
msgid "Company"
msgstr "Azienda"

#. module: crm_stage_multi_company
#: model:ir.model,name:crm_stage_multi_company.model_crm_lead
msgid "Lead/Opportunity"
msgstr "Contatto/Opportunità"

#. module: crm_stage_multi_company
#: model:ir.model.fields,help:crm_stage_multi_company.field_crm_stage__company_id
msgid ""
"Specific company that uses this stage. Other companies will not be able to "
"see or use this stage."
msgstr ""
"Azienda specifica che utilizza questa fase. Altre aziende non saranno in "
"grado di vedere o utilizzare questa fase."

#. module: crm_stage_multi_company
#: model:ir.model.fields,field_description:crm_stage_multi_company.field_crm_lead__stage_id
msgid "Stage"
msgstr "Fase"
2 changes: 2 additions & 0 deletions crm_stage_multi_company/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import crm_stage
from . import crm_lead
18 changes: 18 additions & 0 deletions crm_stage_multi_company/models/crm_lead.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com)
# Copyright 2025 ACSONE SA/NV (https://www.acsone.eu)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class CrmLead(models.Model):
_inherit = "crm.lead"

stage_id = fields.Many2one(check_company=True)

@api.model
def _read_group_stage_ids(self, stages, domain):
# Only return the stages the user has access to due to the new
# multi company rule
res = super()._read_group_stage_ids(stages, domain)
return stages.search([("id", "in", res.ids)])
18 changes: 18 additions & 0 deletions crm_stage_multi_company/models/crm_stage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2019 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class CrmStage(models.Model):
_inherit = "crm.stage"
_check_company_auto = True

company_id = fields.Many2one(
"res.company",
string="Company",
index=True,
help="Specific company that uses this stage. "
"Other companies will not be able to see or use this stage.",
default=lambda self: self.env.company,
)
3 changes: 3 additions & 0 deletions crm_stage_multi_company/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions crm_stage_multi_company/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Quentin Groulard \<quentin.groulard@acsone.eu\>
([ACSONE](https://acsone.eu/))
8 changes: 8 additions & 0 deletions crm_stage_multi_company/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
This module adds support for multi company on crm stage.

The new multi company rule prevents any user without access to all stages to open
the CRM application. This behaviour comes from the kanban view and especially from
he read_group (_read_group_fill_results) which tries to retrieve fold information
from the stages even those without any lead. So to only do this on accessible
stages a search is made by the current user over the stage ids returned by the
group_expand method which is initially launched through a sudo.
8 changes: 8 additions & 0 deletions crm_stage_multi_company/security/crm_security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="crm_stage_company_rule" model="ir.rule">
<field name="name">CRM Stage Multi-Company</field>
<field name="model_id" ref="crm.model_crm_stage" />
<field name="domain_force">[('company_id', 'in', company_ids + [False])]</field>
</record>
</odoo>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading