XML File Formats

Format

  • Declaring a record in XML
  • Place the id attribute before the 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 the 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 “no update” data. Else you can use one of these-
  • The name attribute is first
  • The value attribute is either in the field tag or in the eval attribute. After that follow other attributes according to priorities
    <odoo> : for noupdate=0
    <odoo noupdate='1'>
  • Do not prefix xmlid with the current module's name

Records

  • For records of model ir.filters use explicit user_id field

Naming Xml_id

Security, View, and Action
Use the 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 a name that does not follow the guidelines set, follow naming the inherited view after the original over using a name that follows the guidelines.
  • This simplifies looking towards the original view as well as other inheritance in case if they have the same name.

External Dependencies

__openerp__.py
  • If any of your modules use extra dependencies of python or binaries, you need to add it to the 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 the bin needs to be in PATH and check by running which external_dependency_binary_N
Import Error
  • If external dependencies are 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 the module and its external dependencies are installed.

Readme

  • If a module uses extra dependencies of python or binaries, then explain how to install them in the README.rst file in the section Installation.