At B2CK when developing an implementation for our customers we usually create one module with a bunch of backports of some issues, some customisations, etc.
It’s been some years that we’ve practiced this way and it works kind of great but it could be better.
- There is this requirement to repeat the name of module when invoking
Pool.register
- The XML files must be specified in the tryton.cfg
We’ve discussed with @ced how we could make it better and we’ve got some ideas that require some development (not much) but we’d like to receive some input from the community.
The idea is that in the tryton.cfg
we would have a new section (submodules
maybe) that would contain a list of sub-directory names that contain the submodule code and XML.
What would be cool would be that when specifying name of a view or the path of an icon, it’s not required to use the name of the submodule.
Which means that this XML:
<record model="ir.ui.view" id="organization_view_list">
<field name="model">country.organization</field>
<field name="type">tree</field>
<field name="name">organization_list</field>
</record>
in a submodule named sub
would reference the file module/view/sub/organization_list.xml
. But I’m not sure that’s doable so we might have to settle to use XML entities or even Genshi not to repeat ourselves too much.
For the translations unfortunately as all the translations of a module are currently exported as a unique file they are not suited to be put into the submodule directory.
An idea that was rejected was to have view
and icons
directory into the submodule. The rational for this is that it would be difficult to explain to newcomers the difference between a module and a submodule if their structure is too much alike. With the same reasoning even if I named the configuration file of the submodule tryton.cfg
, I’m not sure that it should be named like that.
Here’s the structure we could have:
tryton-module
├── __init__.py
├── code.py
├── code.xml
├── tryton.cfg
├── icons
│ ├── cool_icon.svg
│ └── sub_module
│ └── even_cooler_icon.svg
├── locale
│ ├── de.po
│ └── fr.po
├── sub_module
│ ├── __init__.py
│ ├── extension.py
│ ├── extension.xml
│ ├── tryton.cfg
│ └── tests
│ ├── __init__.py
│ ├── scenario_extension.rst
│ ├── test_module.py
│ └── test_scenario.py
├── tests
│ ├── __init__.py
│ ├── scenario.rst
│ ├── test_module.py
│ └── test_scenario.py
└── view
├── form.xml
├── list.xml
└── sub_module
├── form_extension.xml
└── list_extension.xml
What do you think about that? Would you adopt this structure for your own customization?