Package: odoo12-addon-base-multi-company
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 contentsUsageMulti Company AbstractHooksBug TrackerCreditsAuthorsContributorsMaintainersUsageImplementationMulti Company AbstractThemulti.company.abstractmodel 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 themulti.company.abstractmodel, you must take care that
it is the first model listed in the_inheritarrayclassProductTemplate(models.Model):_inherit=["multi.company.abstract","product.template"]_name="product.template"_description="Product Template (Multi-Company)"The following fields are provided bymulti.company.abstract:company_ids- All of the companies that this record belongs to. This is a
specialres.company.assignmentview, 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.HooksA genericpost_init_hookanduninstall_hookis 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.importlogging_logger=logging.getLogger(__name__)try:fromodoo.addons.base_multi_companyimporthooksexceptImportError:_logger.info('Cannot find `base_multi_company` module in addons path.')defpost_init_hook(cr,registry):hooks.post_init_hook(cr,'product.product_comp_rule','product.template',)defuninstall_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_rulein the above example).Bug TrackerBugs are tracked onGitHub 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 welcomedfeedback.Do not contact contributors directly about support or help with technical issues.CreditsAuthorsLasLabsTecnativaContributorsDave Lasley <dave@laslabs.com>Pedro M. Baeza <pedro.baeza@tecnativa.com>Laurent Mignon <laurent.mignon@acsone.eu>Cédric Pigeon <cedric.pigeon@acsone.eu>Rodrigo Ferreira <rodrigosferreira91@gmail.com>Florian da Costa <florian.dacosta@akretion.com>MaintainersThis module is maintained by the OCA.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.Currentmaintainer:This module is part of theOCA/multi-companyproject on GitHub.You are welcome to contribute. To learn how please visithttps://odoo-community.org/page/Contribute.