← Back to team overview

openerp-expert-framework team mailing list archive

Re: forbid the installation of incompatible modules

 

On 05/22/2012 01:35 PM, Alexandre Fayolle wrote:
> I'm coding a module which is similar in purpose to product_margin but
> works with a very different flow, which makes it meaningless to have
> both modules installed at the same time on a given instance. Is there a
> way of forbidding the installation of one of the two modules if the
> other one is already there, such as the Conflicts: field in a Debian
> package? This would mean that I'm able to use some of the nicely named
> columns from product_margin in my module.

There is no exclusion mechanism foreseen in the API yet, because it's usually
better to make the modules properly orthogonal and compatible with each other,
or explicitly dependent of each other.
For example if your module kind of supersedes product_margin, you could make it
depend on it and reuse whatever columns you like, while
hiding/disabling/overriding the rest of the module. That makes perfect sense in
terms of modularity and dependencies.

Now, you could probably introduce a specific hack in your module that raises an
error when the classes are loaded if the state of the product_margin module is
not 'uninstalled'. This should prevent installing both modules on the same
database. But I would avoid this hack if possible.


Follow ups

References