There is some non-obvious issue with external dependency in modules, which I want to say.
Let you need to use some python lib, which is not available in system by default and should be installed manually.
So you just make import:
And maybe you mention required dependence in module's description. Very simple, right? But…
The case could crash odoo completely.
This is scenario when it could happen:
- User is not going to use your module with external dependency, but
your module available in Local Modules. E.g. if have a lot of
modules in your git repository and user just makes
git cloneand add path to repo to
- User's system doesn't have required dependency
- Your module has
static/folder, e.g. to place icon.png file.
Then right after restarting server, user would get error:
Whenever you use external dependency, put your import code in try block
external_dependencies to module's manifest:
It will check dependencies before installing and will not raise ImportError if user doesn't use module.