Skip to Content

Contributors

Re: Plugin/module multiplexer/switcher for multi company

The only problem with the dynamic dispatching according method name is that the code discoverability is more difficult, as you usually look for occurrences of your full method name in other parts of the code, which doesn't happen here. I recently suggest to use a similar approach using inheritance here:


and attended by Denis here:


Regards.

by Pedro M. Baeza - 02:40 - 9 Feb 2022

Reference

  • Plugin/module multiplexer/switcher for multi company
    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
    
    
    

    by Radovan Skolnik - 11:26 - 8 Feb 2022