XML FILE FORMATS
Format
-
Declaring a record in XML
-
Place id attribute before model
-
For field declarations-
-
-
Group the records by model. In case of any dependencies like action/menu/views, the convention may not be applicable
-
Use naming convention defined at the next point
-
-
To set not-updatable data, the <data> tag is set as
noupdate=1 value, when the data file has a mix of “noupdate ” data. Else you can use one of these- -
The name attribute is first
-
The value attribute is either in field tag or in eval attribute. After that follows other attributes according to priorities
-
-
<odoo> : for noupdate=0
-
<odoo noupdate='1'>
-
-
Do not prefix
xmlid with current module's name
Records
For records of model ir.filters use explicit user_id field
Naming xml_id
Security, View and Action
Use following patterns :
-
For menu: <model_name>_menu
-
For view: <model_name>_view_<view_type>, where;
-
-
view_type is kanban, tree, form, search or other basic elements
-
-
For action: The main action syntax is <model_name>_action. It is further suffixed with _<detail>, where;
-
-
detail is an underscore lowercase string explaining the action.
-
-
For group: <model_name>_group_<group_name>, where;
-
-
group_name is the name of the group, like- user, manager, etc.
-
-
For rule: <model_name>_rule_<concerned_group>, where;
-
-
concerned_group is the short name of concerned group.
-
Inherited XML :
-
A module can extend its view only one time.
-
The naming rules must be followed when a view is inherited while the module name prevents
xid conflicts. -
If an inherited view has
name that does not follow the guidelines set, follow naming inherited view after original over usingname that follows the guidelines. -
This simplifies looking towards original view as well as other inheritance in case if they have
same name.
External Dependencies
__openerp__.py
-
If any of your modules uses extra dependencies of python or binaries, you need to add it to external_dependencies section to the __openerp__.py
-
An entry in python needs to be in the PYTHONPATH. It is checked by running python -c “import external_dependency_python_N”
-
An entry in bin needs to be in PATH and check by running which external_dependency_binary_N
ImportError
-
If external dependencies used, you need to add try-except with a debug log.
-
Test files are the exception as these files are loaded while running tests where module and its external dependencies are installed.