Contributors mailing list archives

Browse archives


Re: Plugin/module multiplexer/switcher for multi company

by "Graeme Gellatly" <> - 09/02/2022 12:32:35

It sounds to me like you are suggesting a standard dispatcher.

There is already plenty of this in Odoo. Company specific headers, company specific pricelists, bank specific imports, EDI processing orders, specific commands (those are dynamically defined and executed, probably best example for this).

Just define a parent module with a standard API dispatcher and a selection field (or Char) where it makes sense.

e.g in base module - very pseudo if its python, if it is web based or you just need a URL for standard data maybe it may be different but you get the idea.
class Company:
field = fields.Selection(base)

class Partner:
def complete:
  return getattr(self, 'complete_{self.env.user_id.company_id.field}', self.complete_base)()

def complete base

extension module
add field to selection say modb
def complete_modb()

On Wed, Feb 9, 2022 at 8:51 PM Radovan Skolnik <> wrote:

the question was meant more towards good design of something that covers the 
same area functionally (in this case partner autocomplete) but needs to 
provide more implementations that are chosen based on certain criteria.

So in my case I need to have more than one different implementation of the same 
functionality present in the system and choose the appropriate one - in my 
case based on current company being active and configuration for that company.

That leads me to some kind plugin system and was wondering if there was 
anything like that existing in Odoo / OCA already.

Best regards


On streda 9. februára 2022 6:52:24 CET Bruno Joliveau wrote:

> Hi,

> I think it's probably different from a context to another.

> In our case, the majority of our customers work internationally. Their

> search for information is dissociated. The autocomplete is not linked to

> the company in which the user is connected but the country on which he

> creates the new partner for which he is looking for information. All the

> countries we needed to cover for this customer had different connection

> modes and incompatible data structures. We have therefore chosen to process

> outside Odoo in order to standardize the structure of the results thanks to

> different mappings. Odoo connects to the service, the service gets data and

> digests the information. Hope it helps !



> *Bruno Joliveau* - Président NUMIGI SOLUTIONS INC.

> [1]  (514) 317-7944

> Longueuil, Québec, Canada [2]

> None [3]   None [4]   None [5]   None [6]

> [7]


> Le mar. 8 févr. 2022 à 17:27, Radovan Skolnik < [8] > a

> écrit : Hi!

> I have a client that has multi company installation. Each company resides in

> a different country. For each country I have created a module that acts the

> same as partner_autocomplate but retrieveing data from their local

> authorities (state registers). Now I would like to create something as a

> plugin system where the client could use all of these modules for different

> companies. So I'd need to create some sort of plugins and

> multiplexer/switcher that would route requests to appropriate plugin. Is

> there anything like that already existing in Odoo? One approach that I see

> would be creating that multiplexer/switcher as a main module that would

> provide company-specific configuration. Each of the plugin modules would be

> a module of its own extending the main module's list of available plugins

> implemented as fields.Selection via selection_add. That selection would be

> used as company-specific configuration to know, which plugin should server

> the requests. So when requests comes and it is passed through plugins each

> would be able to tell whether it's the correct one to serve it. Is there a

> better way to do this? Any suggestions are welcome.

> Best regards

> Radovan Skolnik



> _______________________________________________

> Mailing-List: [9]

> Post to: mailto: [10]

> Unsubscribe: [11]



> _______________________________________________

> Mailing-List: [12]

> Post to:

> Unsubscribe: [13]




> [1]

> [2]

> [3]

> [4]

> [5]

> [6]

> [7]

> [8]

> [9]

> [10]

> [11]

> [12]

> [13]

Post to: