Skip to main content

Multi Company Base

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

This module provides an abstract model to be inherited by models that need to implement multi-company functionality.

No direct functionality is provided by this module.

Table of contents

Usage

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

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.

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.

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).

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

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

Credits

Authors

  • 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.

Metadata

Release files for odoo13-addon-base-multi-company 13.0.1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for odoo13-addon-base-multi-company 13.0.1.0.3
File Interpreter ABI Platform Actions
odoo13_addon_base_multi_company-13.0.1.0.3-py3-none-any.whl Python 3 none any Details for odoo13_addon_base_multi_company-13.0.1.0.3-py3-none-any.whl

Release files / odoo13_addon_base_multi_company-13.0.1.0.3-py3-none-any.whl

Download URL odoo13_addon_base_multi_company-13.0.1.0.3-py3-none-any.whl
Size 37.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
13f5c97c6d700fe538bca9cee8ecaa93e86c547e0c3b0ad82fa8896f3a79937c
BLAKE2b-256 checksum
How to use checksums
6ecd8c17a358dcfc875570b226ba2338478cd72394811d600b0c2b82753d77cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/58.0.2 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.5

Security for odoo13-addon-base-multi-company 13.0.1.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page