diff --git a/base_multi_company/README.rst b/base_multi_company/README.rst deleted file mode 100644 index 73497dd0e94..00000000000 --- a/base_multi_company/README.rst +++ /dev/null @@ -1,111 +0,0 @@ -================== -Multi Company Base -================== - -.. - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! This file is generated by oca-gen-addon-readme !! - !! changes will be overwritten. !! - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:964598216860da55dff4212af38c17fa514bf5739b27f4f464c058aea5cdc293 - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png - :target: https://odoo-community.org/page/development-status - :alt: Production/Stable -.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png - :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html - :alt: License: LGPL-3 -.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmulti--company-lightgray.png?logo=github - :target: https://github.com/OCA/multi-company/tree/16.0/base_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-16-0/multi-company-16-0-base_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=16.0 - :alt: Try me on Runboat - -|badge1| |badge2| |badge3| |badge4| |badge5| - -This module will provide a way to change the way Odoo manages a 'multi-company' -implementation. - -Abstract --------- - -Odoo traditional implementation of multi-company: - -- Some models contain a field named Company (company_id) that allows to set one company or None - in order to: - - Limit access to that company if set. - - not limiting access to any company if not set. - -This module changes that in order to introduce a finer company access. -e.g.: If you want to give record access to company A and B but not for C. - -This module is not doing anything by its own but provide a transversal implementation -for further ones. -e.g.: If you want to implement OCA multi-company behaviour for products, install -also the 'product_multi_company' or 'partner_multi_company' modules. - -**Table of contents** - -.. contents:: - :local: - -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 to smash it by providing a detailed and welcomed -`feedback `_. - -Do not contact contributors directly about support or help with technical issues. - -Credits -======= - -Authors -~~~~~~~ - -* ACSONE SA/NV -* LasLabs -* Tecnativa - -Contributors -~~~~~~~~~~~~ - -* Dave Lasley -* Pedro M. Baeza -* Laurent Mignon -* Cédric Pigeon -* Rodrigo Ferreira -* Florian da Costa -* Denis Roussel - -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. - -.. |maintainer-pedrobaeza| image:: https://github.com/pedrobaeza.png?size=40px - :target: https://github.com/pedrobaeza - :alt: pedrobaeza - -Current `maintainer `__: - -|maintainer-pedrobaeza| - -This module is part of the `OCA/multi-company `_ project on GitHub. - -You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_multi_company/__init__.py b/base_multi_company/__init__.py deleted file mode 100644 index 0639de1b619..00000000000 --- a/base_multi_company/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright 2017 LasLabs Inc. -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). - -from . import models diff --git a/base_multi_company/__manifest__.py b/base_multi_company/__manifest__.py deleted file mode 100644 index f72e9c112d5..00000000000 --- a/base_multi_company/__manifest__.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2017 LasLabs Inc. -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). - -{ - "name": "Multi Company Base", - "summary": "Provides a base for adding multi-company support to models.", - "version": "16.0.1.0.2", - "author": "ACSONE SA/NV, LasLabs, Tecnativa, Odoo Community Association (OCA)", - "category": "base", - "website": "https://github.com/OCA/multi-company", - "license": "LGPL-3", - "installable": True, - "application": False, - "development_status": "Production/Stable", - "maintainers": ["pedrobaeza"], -} diff --git a/base_multi_company/hooks.py b/base_multi_company/hooks.py deleted file mode 100644 index 7fd8ecfc96b..00000000000 --- a/base_multi_company/hooks.py +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright 2015-2016 Pedro M. Baeza -# Copyright 2017 LasLabs Inc. -# License LGPL-3 - See http://www.gnu.org/licenses/lgpl-3.0.html -from odoo import SUPERUSER_ID, api - -__all__ = [ - "post_init_hook", - "uninstall_hook", -] - - -def set_security_rule(env, rule_ref): - """Set the condition for multi-company in the security rule. - - :param: env: Environment - :param: rule_ref: XML-ID of the security rule to change. - """ - rule = env.ref(rule_ref) - if not rule: # safeguard if it's deleted - return - rule.write( - { - "active": True, - "domain_force": ("[('company_ids', 'in', [False] + company_ids)]"), - } - ) - - -def post_init_hook(cr, rule_ref, model_name): - """Set the `domain_force` and default `company_ids` to `company_id`. - - Args: - cr (Cursor): Database cursor to use for operation. - rule_ref (string): XML ID of security rule to write the - `domain_force` from. - model_name (string): Name of Odoo model object to search for - existing records. - """ - env = api.Environment(cr, SUPERUSER_ID, {}) - set_security_rule(env, rule_ref) - # Copy company values - model = env[model_name] - table_name = model._fields["company_ids"].relation - column1 = model._fields["company_ids"].column1 - column2 = model._fields["company_ids"].column2 - SQL = """ - INSERT INTO {} - ({}, {}) - SELECT id, company_id FROM {} WHERE company_id IS NOT NULL - ON CONFLICT DO NOTHING - """.format( - table_name, - column1, - column2, - model._table, - ) - env.cr.execute(SQL) - - -def uninstall_hook(cr, rule_ref): - """Restore product rule to base value. - - Args: - cr (Cursor): Database cursor to use for operation. - rule_ref (string): XML ID of security rule to remove the - `domain_force` from. - """ - env = api.Environment(cr, SUPERUSER_ID, {}) - # Change access rule - rule = env.ref(rule_ref) - rule.write( - { - "active": False, - "domain_force": (" [('company_id', 'in', [False, user.company_id.id])]"), - } - ) diff --git a/base_multi_company/i18n/base_multi_company.pot b/base_multi_company/i18n/base_multi_company.pot deleted file mode 100644 index 76896d7ff5f..00000000000 --- a/base_multi_company/i18n/base_multi_company.pot +++ /dev/null @@ -1,34 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * base_multi_company -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 16.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: base_multi_company -#: model:ir.model,name:base_multi_company.model_base -msgid "Base" -msgstr "" - -#. module: base_multi_company -#: model:ir.model.fields,field_description:base_multi_company.field_multi_company_abstract__company_ids -msgid "Companies" -msgstr "" - -#. module: base_multi_company -#: model:ir.model.fields,field_description:base_multi_company.field_multi_company_abstract__company_id -msgid "Company" -msgstr "" - -#. module: base_multi_company -#: model:ir.model,name:base_multi_company.model_multi_company_abstract -msgid "Multi-Company Abstract" -msgstr "" diff --git a/base_multi_company/i18n/es.po b/base_multi_company/i18n/es.po deleted file mode 100644 index 5400485204d..00000000000 --- a/base_multi_company/i18n/es.po +++ /dev/null @@ -1,49 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * base_multi_company -# -# Translators: -# OCA Transbot , 2017 -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 10.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-12-16 02:03+0000\n" -"PO-Revision-Date: 2023-12-07 18:35+0000\n" -"Last-Translator: Ivorra78 \n" -"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" -"Language: es\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 4.17\n" - -#. module: base_multi_company -#: model:ir.model,name:base_multi_company.model_base -msgid "Base" -msgstr "Base" - -#. module: base_multi_company -#: model:ir.model.fields,field_description:base_multi_company.field_multi_company_abstract__company_ids -msgid "Companies" -msgstr "Compañías" - -#. module: base_multi_company -#: model:ir.model.fields,field_description:base_multi_company.field_multi_company_abstract__company_id -msgid "Company" -msgstr "Compañía" - -#. module: base_multi_company -#: model:ir.model,name:base_multi_company.model_multi_company_abstract -msgid "Multi-Company Abstract" -msgstr "Resumen Multi-Compañía" - -#~ msgid "Display Name" -#~ msgstr "Nombre mostrado" - -#~ msgid "ID" -#~ msgstr "ID" - -#~ msgid "Last Modified on" -#~ msgstr "Última modificación el" diff --git a/base_multi_company/i18n/es_AR.po b/base_multi_company/i18n/es_AR.po deleted file mode 100644 index dfbc8374850..00000000000 --- a/base_multi_company/i18n/es_AR.po +++ /dev/null @@ -1,46 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * base_multi_company -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 13.0\n" -"Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-12-09 23:47+0000\n" -"Last-Translator: Ignacio Buioli \n" -"Language-Team: none\n" -"Language: es_AR\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 4.17\n" - -#. module: base_multi_company -#: model:ir.model,name:base_multi_company.model_base -msgid "Base" -msgstr "Base" - -#. module: base_multi_company -#: model:ir.model.fields,field_description:base_multi_company.field_multi_company_abstract__company_ids -msgid "Companies" -msgstr "Compañías" - -#. module: base_multi_company -#: model:ir.model.fields,field_description:base_multi_company.field_multi_company_abstract__company_id -msgid "Company" -msgstr "Compañía" - -#. module: base_multi_company -#: model:ir.model,name:base_multi_company.model_multi_company_abstract -msgid "Multi-Company Abstract" -msgstr "Resumen de Multi-Compañía" - -#~ msgid "Display Name" -#~ msgstr "Mostrar Nombre" - -#~ msgid "ID" -#~ msgstr "ID" - -#~ msgid "Last Modified on" -#~ msgstr "Última Modificación el" diff --git a/base_multi_company/i18n/fr.po b/base_multi_company/i18n/fr.po deleted file mode 100644 index e108d721e2a..00000000000 --- a/base_multi_company/i18n/fr.po +++ /dev/null @@ -1,39 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * base_multi_company -# -# Translators: -# OCA Transbot , 2017 -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 10.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-12-16 02:03+0000\n" -"PO-Revision-Date: 2017-12-16 02:03+0000\n" -"Last-Translator: OCA Transbot , 2017\n" -"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" -"Language: fr\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" - -#. module: base_multi_company -#: model:ir.model,name:base_multi_company.model_base -msgid "Base" -msgstr "" - -#. module: base_multi_company -#: model:ir.model.fields,field_description:base_multi_company.field_multi_company_abstract__company_ids -msgid "Companies" -msgstr "Sociétés" - -#. module: base_multi_company -#: model:ir.model.fields,field_description:base_multi_company.field_multi_company_abstract__company_id -msgid "Company" -msgstr "" - -#. module: base_multi_company -#: model:ir.model,name:base_multi_company.model_multi_company_abstract -msgid "Multi-Company Abstract" -msgstr "" diff --git a/base_multi_company/i18n/hr.po b/base_multi_company/i18n/hr.po deleted file mode 100644 index 7d1f7199725..00000000000 --- a/base_multi_company/i18n/hr.po +++ /dev/null @@ -1,62 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * base_multi_company -# -# Translators: -# Bole , 2018 -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 10.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-01-27 07:37+0000\n" -"PO-Revision-Date: 2019-11-14 16:34+0000\n" -"Last-Translator: Bole \n" -"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" -"Language: hr\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" -"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" -"X-Generator: Weblate 3.8\n" - -#. module: base_multi_company -#: model:ir.model,name:base_multi_company.model_base -msgid "Base" -msgstr "" - -#. module: base_multi_company -#: model:ir.model.fields,field_description:base_multi_company.field_multi_company_abstract__company_ids -msgid "Companies" -msgstr "Tvrtke" - -#. module: base_multi_company -#: model:ir.model.fields,field_description:base_multi_company.field_multi_company_abstract__company_id -msgid "Company" -msgstr "Tvrtka" - -#. module: base_multi_company -#: model:ir.model,name:base_multi_company.model_multi_company_abstract -msgid "Multi-Company Abstract" -msgstr "Multi Tvrtka - Apstraktno" - -#~ msgid "Display Name" -#~ msgstr "Naziv za prikaz" - -#~ msgid "ID" -#~ msgstr "ID" - -#~ msgid "Last Modified on" -#~ msgstr "Zadnje modificirano" - -#~ msgid "Name" -#~ msgstr "Naziv" - -#~ msgid "Parent" -#~ msgstr "ID Nadređenog" - -#~ msgid "Res Company Assignment" -#~ msgstr "Dodjeljena tvrtka" - -#~ msgid "Visible For All Companies" -#~ msgstr "Vidljivo za sve tvrtke" diff --git a/base_multi_company/i18n/it.po b/base_multi_company/i18n/it.po deleted file mode 100644 index f59041936af..00000000000 --- a/base_multi_company/i18n/it.po +++ /dev/null @@ -1,37 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * base_multi_company -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 16.0\n" -"Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2024-01-19 19:35+0000\n" -"Last-Translator: mymage \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 4.17\n" - -#. module: base_multi_company -#: model:ir.model,name:base_multi_company.model_base -msgid "Base" -msgstr "Base" - -#. module: base_multi_company -#: model:ir.model.fields,field_description:base_multi_company.field_multi_company_abstract__company_ids -msgid "Companies" -msgstr "Aziende" - -#. module: base_multi_company -#: model:ir.model.fields,field_description:base_multi_company.field_multi_company_abstract__company_id -msgid "Company" -msgstr "Azienda" - -#. module: base_multi_company -#: model:ir.model,name:base_multi_company.model_multi_company_abstract -msgid "Multi-Company Abstract" -msgstr "Multi-azienda astratto" diff --git a/base_multi_company/i18n/nl_NL.po b/base_multi_company/i18n/nl_NL.po deleted file mode 100644 index 253c4647fd7..00000000000 --- a/base_multi_company/i18n/nl_NL.po +++ /dev/null @@ -1,61 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * base_multi_company -# -# Translators: -# Peter Hageman , 2017 -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 10.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-12-16 02:03+0000\n" -"PO-Revision-Date: 2017-12-16 02:03+0000\n" -"Last-Translator: Peter Hageman , 2017\n" -"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/" -"teams/23907/nl_NL/)\n" -"Language: nl_NL\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" - -#. module: base_multi_company -#: model:ir.model,name:base_multi_company.model_base -msgid "Base" -msgstr "" - -#. module: base_multi_company -#: model:ir.model.fields,field_description:base_multi_company.field_multi_company_abstract__company_ids -msgid "Companies" -msgstr "Bedrijven" - -#. module: base_multi_company -#: model:ir.model.fields,field_description:base_multi_company.field_multi_company_abstract__company_id -msgid "Company" -msgstr "Bedrijf" - -#. module: base_multi_company -#: model:ir.model,name:base_multi_company.model_multi_company_abstract -msgid "Multi-Company Abstract" -msgstr "" - -#~ msgid "Display Name" -#~ msgstr "Weergavenaam" - -#~ msgid "ID" -#~ msgstr "ID" - -#~ msgid "Last Modified on" -#~ msgstr "Laatst gewijzigd op" - -#~ msgid "Name" -#~ msgstr "Naam" - -#, fuzzy -#~ msgid "Parent" -#~ msgstr "Parent id" - -#, fuzzy -#~| msgid "res.company.assignment" -#~ msgid "Res Company Assignment" -#~ msgstr "res.company.assignment" diff --git a/base_multi_company/i18n/pt.po b/base_multi_company/i18n/pt.po deleted file mode 100644 index 5d949ea0653..00000000000 --- a/base_multi_company/i18n/pt.po +++ /dev/null @@ -1,58 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * base_multi_company -# -# Translators: -# Pedro Castro Silva , 2017 -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 10.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-12-16 07:23+0000\n" -"PO-Revision-Date: 2020-02-22 19:13+0000\n" -"Last-Translator: alvarorib \n" -"Language-Team: Portuguese (https://www.transifex.com/oca/teams/23907/pt/)\n" -"Language: pt\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 3.10\n" - -#. module: base_multi_company -#: model:ir.model,name:base_multi_company.model_base -msgid "Base" -msgstr "" - -#. module: base_multi_company -#: model:ir.model.fields,field_description:base_multi_company.field_multi_company_abstract__company_ids -msgid "Companies" -msgstr "Empresas" - -#. module: base_multi_company -#: model:ir.model.fields,field_description:base_multi_company.field_multi_company_abstract__company_id -msgid "Company" -msgstr "Empresa" - -#. module: base_multi_company -#: model:ir.model,name:base_multi_company.model_multi_company_abstract -msgid "Multi-Company Abstract" -msgstr "Abstração Multi-Empresa" - -#~ msgid "Display Name" -#~ msgstr "Nome a Exibir" - -#~ msgid "ID" -#~ msgstr "ID" - -#~ msgid "Last Modified on" -#~ msgstr "Última Modificação Em" - -#~ msgid "Name" -#~ msgstr "Nome" - -#~ msgid "Parent" -#~ msgstr "Ascendente" - -#~ msgid "Visible For All Companies" -#~ msgstr "Visível para todas as Empresas" diff --git a/base_multi_company/i18n/pt_BR.po b/base_multi_company/i18n/pt_BR.po deleted file mode 100644 index 1a301670eef..00000000000 --- a/base_multi_company/i18n/pt_BR.po +++ /dev/null @@ -1,63 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * base_multi_company -# -# Translators: -# falexandresilva , 2017 -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 10.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-06-15 16:43+0000\n" -"PO-Revision-Date: 2024-05-21 00:16+0000\n" -"Last-Translator: Rodrigo Macedo \n" -"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/" -"23907/pt_BR/)\n" -"Language: pt_BR\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 4.17\n" - -#. module: base_multi_company -#: model:ir.model,name:base_multi_company.model_base -msgid "Base" -msgstr "Base" - -#. module: base_multi_company -#: model:ir.model.fields,field_description:base_multi_company.field_multi_company_abstract__company_ids -msgid "Companies" -msgstr "Empresas" - -#. module: base_multi_company -#: model:ir.model.fields,field_description:base_multi_company.field_multi_company_abstract__company_id -msgid "Company" -msgstr "Empresa" - -#. module: base_multi_company -#: model:ir.model,name:base_multi_company.model_multi_company_abstract -msgid "Multi-Company Abstract" -msgstr "Resumo de várias empresas" - -#~ msgid "Display Name" -#~ msgstr "Nome" - -#~ msgid "ID" -#~ msgstr "Identificação" - -#~ msgid "Last Modified on" -#~ msgstr "Última modificação" - -#~ msgid "Name" -#~ msgstr "Nome" - -#~ msgid "Parent" -#~ msgstr "Pai" - -#~ msgid "Res Company Assignment" -#~ msgstr "Res Atribuição da Empresa" - -#~ msgid "Visible For All Companies" -#~ msgstr "Visível para todas as Empresas" diff --git a/base_multi_company/i18n/zh_CN.po b/base_multi_company/i18n/zh_CN.po deleted file mode 100644 index b7ca34983b2..00000000000 --- a/base_multi_company/i18n/zh_CN.po +++ /dev/null @@ -1,58 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * base_multi_company -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" -"Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2019-09-23 10:24+0000\n" -"Last-Translator: 黎伟杰 <674416404@qq.com>\n" -"Language-Team: none\n" -"Language: zh_CN\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: \n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 3.8\n" - -#. module: base_multi_company -#: model:ir.model,name:base_multi_company.model_base -msgid "Base" -msgstr "" - -#. module: base_multi_company -#: model:ir.model.fields,field_description:base_multi_company.field_multi_company_abstract__company_ids -msgid "Companies" -msgstr "公司" - -#. module: base_multi_company -#: model:ir.model.fields,field_description:base_multi_company.field_multi_company_abstract__company_id -msgid "Company" -msgstr "公司" - -#. module: base_multi_company -#: model:ir.model,name:base_multi_company.model_multi_company_abstract -msgid "Multi-Company Abstract" -msgstr "抽象多公司" - -#~ msgid "Display Name" -#~ msgstr "显示名称" - -#~ msgid "ID" -#~ msgstr "ID" - -#~ msgid "Last Modified on" -#~ msgstr "最后修改时间" - -#~ msgid "Name" -#~ msgstr "名称" - -#~ msgid "Parent" -#~ msgstr "上级" - -#~ msgid "Res Company Assignment" -#~ msgstr "公司分配" - -#~ msgid "Visible For All Companies" -#~ msgstr "对所有公司可见" diff --git a/base_multi_company/models/__init__.py b/base_multi_company/models/__init__.py deleted file mode 100644 index 3458c9d9b99..00000000000 --- a/base_multi_company/models/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright 2017 LasLabs Inc. -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). - -from . import base -from . import multi_company_abstract diff --git a/base_multi_company/models/base.py b/base_multi_company/models/base.py deleted file mode 100644 index e1ae7d1d983..00000000000 --- a/base_multi_company/models/base.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2023 Tecnativa - Pedro M. Baeza -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). - -from odoo import models - - -class Base(models.AbstractModel): - _inherit = "base" - - def _check_company(self, fnames=None): - """Inject as context the company of the record that is going to be compared - for being taking into account when computing the company of many2one's - relations that links with our multi-company models. - - We have to serialize the call to super, but it doesn't matter in terms of - performance, as super also makes a for loop in the records. - """ - for record in self: - company_source_id = False - if record._name == "res.company": - company_source_id = record.id - elif "company_id" in record._fields: - company_source_id = record.company_id.id - record = record.with_context(_check_company_source_id=company_source_id) - super(Base, record)._check_company(fnames=fnames) - return diff --git a/base_multi_company/models/multi_company_abstract.py b/base_multi_company/models/multi_company_abstract.py deleted file mode 100644 index 63ebeee1e7f..00000000000 --- a/base_multi_company/models/multi_company_abstract.py +++ /dev/null @@ -1,117 +0,0 @@ -# Copyright 2017 LasLabs Inc. -# Copyright 2023 Tecnativa - Pedro M. Baeza -# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). - -from odoo import api, fields, models - - -class MultiCompanyAbstract(models.AbstractModel): - - _name = "multi.company.abstract" - _description = "Multi-Company Abstract" - - company_id = fields.Many2one( - string="Company", - comodel_name="res.company", - compute="_compute_company_id", - search="_search_company_id", - inverse="_inverse_company_id", - ) - company_ids = fields.Many2many( - string="Companies", - comodel_name="res.company", - ) - - @api.depends("company_ids") - @api.depends_context("company", "_check_company_source_id") - def _compute_company_id(self): - for record in self: - # Set this priority computing the company (if included in the allowed ones) - # for avoiding multi company incompatibility errors: - # - If this call is done from method _check_company, the company of the - # record to be compared. - # - Otherwise, current company of the user. - company_id = ( - self.env.context.get("_check_company_source_id") - or self.env.context.get("force_company") - or self.env.company.id - ) - if company_id in record.company_ids.ids: - record.company_id = company_id - else: - record.company_id = record.company_ids[:1].id - - def _inverse_company_id(self): - # To allow modifying allowed companies by non-aware base_multi_company - # through company_id field we: - # - Remove all companies, then add the provided one - for record in self: - record.company_ids = [(6, 0, record.company_id.ids)] - - def _search_company_id(self, operator, value): - return [("company_ids", operator, value)] - - @api.model_create_multi - def create(self, vals_list): - """Discard changes in company_id field if company_ids has been given.""" - for vals in vals_list: - if "company_ids" in vals and "company_id" in vals: - del vals["company_id"] - return super().create(vals_list) - - def write(self, vals): - """Discard changes in company_id field if company_ids has been given.""" - if "company_ids" in vals and "company_id" in vals: - del vals["company_id"] - return super().write(vals) - - @api.model - def _patch_company_domain(self, args): - # In some situations the 'in' operator is used with company_id in a - # name_search or search_read. ORM does not convert to a proper WHERE clause when using - # the 'in' operator. - # e.g: ``` - # WHERE "res_partner"."id" in (SELECT "res_partner_id" - # FROM "res_company_res_partner_rel" WHERE "res_company_id" IN (False, 1) - # ``` - # patching the args to expand the cumbersome args int a OR clause fix - # the issue. - # e.g: ``` - # WHERE "res_partner"."id" not in (SELECT "res_partner_id" - # FROM "res_company_res_partner_rel" - # where "res_partner_id" is not null) - # OR ("res_partner"."id" in (SELECT "res_partner_id" - # FROM "res_company_res_partner_rel" WHERE "res_company_id" IN 1) - # ``` - new_args = [] - if args is None: - args = [] - for arg in args: - if type(arg) == list and arg[:2] == ["company_id", "in"]: - fix = [] - for _i in range(len(arg[2]) - 1): - fix.append("|") - for val in arg[2]: - fix.append(["company_id", "=", val]) - new_args.extend(fix) - else: - new_args.append(arg) - return new_args - - @api.model - def _name_search( - self, name, args=None, operator="ilike", limit=100, name_get_uid=None - ): - new_args = self._patch_company_domain(args) - return super()._name_search( - name, - args=new_args, - operator=operator, - limit=limit, - name_get_uid=name_get_uid, - ) - - @api.model - def search_read(self, domain=None, fields=None, offset=0, limit=None, order=None): - new_domain = self._patch_company_domain(domain) - return super().search_read(new_domain, fields, offset, limit, order) diff --git a/base_multi_company/readme/CONTRIBUTORS.rst b/base_multi_company/readme/CONTRIBUTORS.rst deleted file mode 100644 index 1f667b12056..00000000000 --- a/base_multi_company/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,7 +0,0 @@ -* Dave Lasley -* Pedro M. Baeza -* Laurent Mignon -* Cédric Pigeon -* Rodrigo Ferreira -* Florian da Costa -* Denis Roussel diff --git a/base_multi_company/readme/DESCRIPTION.rst b/base_multi_company/readme/DESCRIPTION.rst deleted file mode 100644 index 70fa8c8ce23..00000000000 --- a/base_multi_company/readme/DESCRIPTION.rst +++ /dev/null @@ -1,20 +0,0 @@ -This module will provide a way to change the way Odoo manages a 'multi-company' -implementation. - -Abstract --------- - -Odoo traditional implementation of multi-company: - -- Some models contain a field named Company (company_id) that allows to set one company or None - in order to: - - Limit access to that company if set. - - not limiting access to any company if not set. - -This module changes that in order to introduce a finer company access. -e.g.: If you want to give record access to company A and B but not for C. - -This module is not doing anything by its own but provide a transversal implementation -for further ones. -e.g.: If you want to implement OCA multi-company behaviour for products, install -also the 'product_multi_company' or 'partner_multi_company' modules. diff --git a/base_multi_company/readme/DEVELOPER.rst b/base_multi_company/readme/DEVELOPER.rst deleted file mode 100644 index 36ce0d0d30d..00000000000 --- a/base_multi_company/readme/DEVELOPER.rst +++ /dev/null @@ -1,71 +0,0 @@ -Implementation -~~~~~~~~~~~~~~ - -Multi Company Abstract ----------------------- - -The `multi.company.abstract` model is meant to be inherited by any model that -wants to implement multi-company functionality. The logic does not require a -pre-existing company field on the inheriting model, but will not be affected -if one does exist. - -When inheriting the `multi.company.abstract` model, you must take care that -it is the first model listed in the `_inherit` array - -.. code-block:: python - - class ProductTemplate(models.Model): - _inherit = ["multi.company.abstract", "product.template"] - _name = "product.template" - _description = "Product Template (Multi-Company)" - -The following fields are provided by `multi.company.abstract`: - -* `company_ids` - All of the companies that this record belongs to. This is a - special `res.company.assignment` view, which allows for the circumvention of - standard cross-company security policies. These policies would normally - restrict a user from seeing another company unless it is currently operating - under that company. Be aware of apples to oranges issues when comparing the - records from this field against actual company records. -* `company_id` - Passes through a singleton company based on the current user, - and the allowed companies for the record. -* `no_company_ids` - As there is a limitation in Odoo ORM to get real False values - in Many2many fields (solved on 2022-03-23 https://github.com/odoo/odoo/pull/81344). - -Hooks ------ - -A generic `post_init_hook` and `uninstall_hook` is provided, which will alter -a pre-existing single-company security rule to be multi-company aware. - -These hooks will unfortunately not work in every circumstance, but they cut out -significant boilerplate when relevant. - -.. code-block:: python - - import logging - - _logger = logging.getLogger(__name__) - - try: - from odoo.addons.base_multi_company import hooks - except ImportError: - _logger.info('Cannot find `base_multi_company` module in addons path.') - - - def post_init_hook(cr, registry): - hooks.post_init_hook( - cr, - 'product.product_comp_rule', - 'product.template', - ) - - - def uninstall_hook(cr, registry): - hooks.uninstall_hook( - cr, - 'product.product_comp_rule', - ) - -A module implementing these hooks would need to first identify the proper rule -for the record (`product.product_comp_rule` in the above example). diff --git a/base_multi_company/static/description/icon.png b/base_multi_company/static/description/icon.png deleted file mode 100644 index 3a0328b516c..00000000000 Binary files a/base_multi_company/static/description/icon.png and /dev/null differ diff --git a/base_multi_company/static/description/index.html b/base_multi_company/static/description/index.html deleted file mode 100644 index d776294465c..00000000000 --- a/base_multi_company/static/description/index.html +++ /dev/null @@ -1,447 +0,0 @@ - - - - - -Multi Company Base - - - -
-

Multi Company Base

- - -

Production/Stable License: LGPL-3 OCA/multi-company Translate me on Weblate Try me on Runboat

-

This module will provide a way to change the way Odoo manages a ‘multi-company’ -implementation.

-
-

Abstract

-

Odoo traditional implementation of multi-company:

-
    -
  • Some models contain a field named Company (company_id) that allows to set one company or None -in order to: -- Limit access to that company if set. -- not limiting access to any company if not set.
  • -
-

This module changes that in order to introduce a finer company access. -e.g.: If you want to give record access to company A and B but not for C.

-

This module is not doing anything by its own but provide a transversal implementation -for further ones. -e.g.: If you want to implement OCA multi-company behaviour for products, install -also the ‘product_multi_company’ or ‘partner_multi_company’ modules.

-

Table of contents

- -
-

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 to smash it by providing a detailed and welcomed -feedback.

-

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

-
-
-

Credits

-
-

Authors

-
    -
  • ACSONE SA/NV
  • -
  • LasLabs
  • -
  • Tecnativa
  • -
-
-
-

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.

-

Current maintainer:

-

pedrobaeza

-

This module is part of the OCA/multi-company project on GitHub.

-

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

-
-
-
-
- - diff --git a/base_multi_company/tests/__init__.py b/base_multi_company/tests/__init__.py deleted file mode 100644 index fe4f0ab37e1..00000000000 --- a/base_multi_company/tests/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# License LGPL-3 - See http://www.gnu.org/licenses/lgpl-3.0.html -from . import test_multi_company_abstract diff --git a/base_multi_company/tests/multi_company_abstract_tester.py b/base_multi_company/tests/multi_company_abstract_tester.py deleted file mode 100644 index 7c90e5a2fc5..00000000000 --- a/base_multi_company/tests/multi_company_abstract_tester.py +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright 2018-19 ForgeFlow S.L. (https://www.forgeflow.com) -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). - -from odoo import fields, models - - -class MultiCompanyAbstractTester(models.Model): - _name = "multi.company.abstract.tester" - _inherit = "multi.company.abstract" - _description = "Multi Company Abstract Tester" - - name = fields.Char() diff --git a/base_multi_company/tests/test_multi_company_abstract.py b/base_multi_company/tests/test_multi_company_abstract.py deleted file mode 100644 index 410b02a7137..00000000000 --- a/base_multi_company/tests/test_multi_company_abstract.py +++ /dev/null @@ -1,282 +0,0 @@ -# Copyright 2017 LasLabs Inc. -# Copyright 2021 ACSONE SA/NV -# License LGPL-3 - See http://www.gnu.org/licenses/lgpl-3.0.html - -from odoo_test_helper import FakeModelLoader - -from odoo.tests import common - - -class TestMultiCompanyAbstract(common.TransactionCase): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.loader = FakeModelLoader(cls.env, cls.__module__) - cls.loader.backup_registry() - - # The fake class is imported here !! After the backup_registry - from .multi_company_abstract_tester import MultiCompanyAbstractTester - - cls.loader.update_registry((MultiCompanyAbstractTester,)) - - cls.test_model = cls.env["multi.company.abstract.tester"] - - cls.tester_model = cls.env["ir.model"].search( - [("model", "=", "multi.company.abstract.tester")] - ) - - # Access record: - cls.env["ir.model.access"].create( - { - "name": "access.tester", - "model_id": cls.tester_model.id, - "perm_read": 1, - "perm_write": 1, - "perm_create": 1, - "perm_unlink": 1, - } - ) - - cls.record_1 = cls.test_model.create({"name": "test"}) - cls.company_1 = cls.env.company - cls.company_2 = cls.env["res.company"].create( - {"name": "Test Co 2", "email": "base_multi_company@test.com"} - ) - - @classmethod - def tearDownClass(cls): - cls.loader.restore_registry() - return super().tearDownClass() - - def add_company(self, company): - """Add company to the test record.""" - self.record_1.company_ids = [(4, company.id)] - - def switch_user_company(self, user, company): - """Add a company to the user's allowed & set to current.""" - user.write( - { - "company_ids": [(6, 0, (company + user.company_ids).ids)], - "company_id": company.id, - } - ) - - def test_compute_company_id(self): - """It should set company_id to the top of the company_ids stack.""" - self.add_company(self.company_2) - self.env.user.company_ids = [(4, self.company_2.id)] - self.env.user.company_id = self.company_2.id - self.assertEqual( - self.record_1.company_id.id, - self.company_2.id, - ) - - def test_search_company_id(self): - """It should return correct record by searching company_id.""" - self.add_company(self.company_2) - record = self.test_model.search( - [ - ("company_id.email", "=", self.company_2.email), - ("id", "=", self.record_1.id), - ] - ) - self.assertEqual(record, self.record_1) - record = self.test_model.search( - [("company_id", "=", self.company_2.id), ("id", "=", self.record_1.id)] - ) - self.assertEqual(record, self.record_1) - record = self.test_model.search( - [ - ("company_ids", "child_of", self.company_2.id), - ("id", "=", self.record_1.id), - ] - ) - self.assertEqual(record, self.record_1) - record = self.test_model.search( - [ - ("company_ids", "parent_of", self.company_2.id), - ("id", "=", self.record_1.id), - ] - ) - self.assertEqual(record, self.record_1) - - name_result = self.test_model.name_search( - "test", [["company_id", "in", [self.company_2.id]]] - ) - # Result is [(, "test")] - self.assertEqual(name_result[0][0], self.record_1.id) - - result = self.test_model.search_read( - [("company_id", "in", [False, self.company_2.id])], ["name"] - ) - self.assertEqual([{"id": self.record_1.id, "name": self.record_1.name}], result) - - def test_patch_company_domain(self): - new_domain = self.test_model._patch_company_domain( - [["company_id", "in", [False, self.company_2.id]]] - ) - self.assertEqual( - ["|", ["company_id", "=", False], ["company_id", "=", self.company_2.id]], - new_domain, - ) - - def test_compute_company_id2(self): - """ - Test the computation of company_id for a multi_company_abstract. - We have to ensure that the priority of the computed company_id field - is given on the current company of the current user. - And not a random company into allowed companies (company_ids of the - target model). - Because most of access rights are based on the current company of the - current user and not on allowed companies (company_ids). - :return: bool - """ - - user_obj = self.env["res.users"] - company_obj = self.env["res.company"] - company1 = self.env.ref("base.main_company") - # Create companies - company2 = company_obj.create({"name": "High salaries"}) - company3 = company_obj.create({"name": "High salaries, twice more!"}) - company4 = company_obj.create({"name": "No salaries"}) - companies = company1 + company2 + company3 - # Create a "normal" user (not the admin) - user = user_obj.create( - { - "name": "Best employee", - "login": "best-emplyee@example.com", - "company_id": company1.id, - "company_ids": [(6, False, companies.ids)], - } - ) - tester_obj = self.test_model.with_user(user) - tester = tester_obj.create( - {"name": "My tester", "company_ids": [(6, False, companies.ids)]} - ) - # Current company_id should be updated with current company of the user - for company in user.company_ids: - user.write({"company_id": company.id}) - # Force recompute - tester.invalidate_model() - # Ensure that the current user is on the right company - self.assertEqual(user.company_id, company) - self.assertEqual(tester.company_id, company) - # So can read company fields without Access error - self.assertTrue(bool(tester.company_id.name)) - # Switch to a company not in tester.company_ids - self.switch_user_company(user, company4) - # Force recompute - tester.invalidate_model() - self.assertNotEqual(user.company_id.id, tester.company_ids.ids) - self.assertTrue(bool(tester.company_id.id)) - self.assertTrue(bool(tester.company_id.name)) - self.assertNotIn(user.company_id.id, tester.company_ids.ids) - - def test_company_id_create(self): - """ - Test object creation with both company_ids and company_id - :return: bool - """ - - user_obj = self.env["res.users"] - company_obj = self.env["res.company"] - company1 = self.env.ref("base.main_company") - # Create companies - company2 = company_obj.create({"name": "High salaries"}) - company3 = company_obj.create({"name": "High salaries, twice more!"}) - companies = company1 + company2 + company3 - # Create a "normal" user (not the admin) - user = user_obj.create( - { - "name": "Best employee", - "login": "best-emplyee@example.com", - "company_id": company1.id, - "company_ids": [(6, False, companies.ids)], - } - ) - tester_obj = self.test_model.with_user(user) - # We add both values - tester = tester_obj.create( - { - "name": "My tester", - "company_id": company1.id, - "company_ids": [(6, False, companies.ids)], - } - ) - # Check if all companies have been added - self.assertEqual(tester.sudo().company_ids, companies) - - def test_company_id_create_false(self): - """ - Test a creation with only company_id == False - """ - - user_obj = self.env["res.users"] - company_obj = self.env["res.company"] - company1 = self.env.ref("base.main_company") - # Create companies - company2 = company_obj.create({"name": "High salaries"}) - company3 = company_obj.create({"name": "High salaries, twice more!"}) - companies = company1 + company2 + company3 - # Create a "normal" user (not the admin) - user = user_obj.create( - { - "name": "Best employee", - "login": "best-emplyee@example.com", - "company_id": company1.id, - "company_ids": [(6, False, companies.ids)], - } - ) - tester_obj = self.test_model.with_user(user) - # We add both values - tester = tester_obj.create( - { - "name": "My tester", - "company_id": False, - } - ) - # Check company_ids is False too - self.assertFalse(tester.sudo().company_ids) - - # Check company_id is False also when changing current one - self.assertFalse(tester.with_company(company2).company_id) - - def test_set_company_id(self): - """ - Test object creation with both company_ids and company_id - :return: bool - """ - - user_obj = self.env["res.users"] - company_obj = self.env["res.company"] - company1 = self.env.ref("base.main_company") - # Create companies - company2 = company_obj.create({"name": "High salaries"}) - company3 = company_obj.create({"name": "High salaries, twice more!"}) - companies = company1 + company2 + company3 - # Create a "normal" user (not the admin) - user = user_obj.create( - { - "name": "Best employee", - "login": "best-emplyee@example.com", - "company_id": company1.id, - "company_ids": [(6, False, companies.ids)], - } - ) - tester_obj = self.test_model.with_user(user) - # We add both values - tester = tester_obj.create( - {"name": "My tester", "company_ids": [(6, False, companies.ids)]} - ) - # Check if all companies have been added - self.assertEqual(tester.sudo().company_ids, companies) - - # Check set company_id - tester.company_id = company1 - - self.assertEqual(tester.sudo().company_ids, company1) - - # Check remove company_id - tester.company_id = False - - self.assertFalse(tester.sudo().company_ids) diff --git a/product_multi_company/__manifest__.py b/product_multi_company/__manifest__.py index 2feafcc64d9..bed2b2d2a39 100644 --- a/product_multi_company/__manifest__.py +++ b/product_multi_company/__manifest__.py @@ -7,7 +7,7 @@ "author": "Tecnativa," "Odoo Community Association (OCA)", "website": "https://github.com/OCA/multi-company", "category": "Product Management", - "version": "15.0.1.0.0", + "version": "17.0.1.0.0", "license": "AGPL-3", "depends": ["base_multi_company", "product", "stock"], "data": ["views/product_template_view.xml"], diff --git a/product_multi_company/hooks.py b/product_multi_company/hooks.py index 257a8ec2f4a..fead0acb50b 100644 --- a/product_multi_company/hooks.py +++ b/product_multi_company/hooks.py @@ -11,16 +11,16 @@ _logger.info("Cannot find `base_multi_company` module in addons path.") -def post_init_hook(cr, registry): +def post_init_hook(env): hooks.post_init_hook( - cr, + env, "product.product_comp_rule", "product.template", ) -def uninstall_hook(cr, registry): +def uninstall_hook(env): hooks.uninstall_hook( - cr, + env, "product.product_comp_rule", ) diff --git a/product_multi_company/models/product_category.py b/product_multi_company/models/product_category.py index 1739ecba22a..3242c7b079f 100644 --- a/product_multi_company/models/product_category.py +++ b/product_multi_company/models/product_category.py @@ -16,7 +16,7 @@ class ProductCategory(models.Model): ) route_ids = fields.Many2many( - "stock.location.route", + "stock.route", "stock_location_route_categ", "categ_id", "route_id", diff --git a/product_multi_company/tests/common.py b/product_multi_company/tests/common.py index a67757af8c9..0e5c24f85f8 100644 --- a/product_multi_company/tests/common.py +++ b/product_multi_company/tests/common.py @@ -10,8 +10,6 @@ def _create_products(cls): cls.product_company_none = cls.product_obj.create( { "name": "Product without company", - "company_ids": [(6, 0, [])], - "company_id": False, } ) cls.product_company_1 = cls.product_obj.with_company(cls.company_1).create( diff --git a/product_multi_company/tests/test_product_multi_company.py b/product_multi_company/tests/test_product_multi_company.py index 55cb3de883b..4e9917e92b9 100644 --- a/product_multi_company/tests/test_product_multi_company.py +++ b/product_multi_company/tests/test_product_multi_company.py @@ -11,8 +11,7 @@ class TestProductMultiCompany(ProductMultiCompanyCommon, common.TransactionCase): def test_create_product(self): product = self.env["product.product"].create({"name": "Test"}) - company = self.env.company - self.assertTrue(company.id in product.company_ids.ids) + self.assertFalse(product.company_ids) def test_company_none(self): self.assertFalse(self.product_company_none.company_id) @@ -63,10 +62,10 @@ def test_company_2(self): def test_uninstall(self): from ..hooks import uninstall_hook - uninstall_hook(self.env.cr, None) + uninstall_hook(self.env) rule = self.env.ref("product.product_comp_rule") domain = ( - " ['|', ('company_id', '=', user.company_id.id), " + " ['|', ('company_id', 'parent_of', company_ids), " "('company_id', '=', False)]" ) self.assertEqual(rule.domain_force, domain)