diff --git a/content/developer/reference/frontend/services.rst b/content/developer/reference/frontend/services.rst index fb6add488..12c002362 100644 --- a/content/developer/reference/frontend/services.rst +++ b/content/developer/reference/frontend/services.rst @@ -116,6 +116,8 @@ Reference List * - Technical Name - Short Description + * - :ref:`company ` + - provides some information related to the companies * - :ref:`cookie ` - read or modify cookies * - :ref:`effect ` @@ -131,6 +133,48 @@ Reference List * - :ref:`user ` - provides some information related to the current user +.. _frontend/services/company: + +Company service +--------------- + +Overview +~~~~~~~~ + +* Technical name: `company` +* Dependencies: `user`, `router`, `cookie` + +Odoo has a concept of companies. You can manage several with the same Odoo instance. +More than one companies can be *active* at any time, but one company is always considered selected. +The selected company is basically considered the current company, but for pages that support it, +the content of all the active companies are displayed. By example, in the product page, the company A may be the main one +but the products of all the active companies are shown. + +This service provides information about them as well as a couple of functions. + +API +~~~ + +.. js:attribute:: availableCompanies: number[] + + Get all the company ids registered in the odoo instance. + +.. js:attribute:: allowedCompanyIds: {id, name}[] + + Get the currently active companies. + +.. js:attribute:: currentCompany: number + + Get the current main company id + +.. js:function:: setCompanies(mode, ...companyIds) + + :param string mode: `loginto` to set as main company (the first one of companyIds parameter is taken), `toggle` to toggle the active state of all the companyIds. + :param number[] companyIds: the company ids impacted. + +Changes the state of the main and active companies. + + .. _frontend/services/cookie: Cookie service