Skip to Content

Odoo code: why formal structure matters in a module

Rigor for better knowledge capitalization
November 10, 2023 by
Odoo code: why formal structure matters in a module
ANOR, Cyrille de LAMBERT

Auguria News

I haven't developed in a long time, but I still end up reading code from modules built on top of the #Odoo core from time to time.

Two things are often forgotten:

  • Well-structured code that follows a rigorous formalism
  • Clear headers in modules

Far too often I see poorly documented code, sometimes written by people who have passed through my team, and it exasperates me!!!

Why well-structured code? Why a rigorous formalism?

  • Readability and understanding: Well-structured code is easier to read and understand. It lets other developers (or your future self) quickly grasp how the code works and what it is meant to do.
  • Maintenance and updates: Code that follows a standard formalism is easier to maintain and update. Bugs are simpler to identify and fix, and changes can be made more safely and efficiently.
  • Collaboration: In a team environment, following coding standards and conventions ensures everyone is on the same page. It makes collaboration and peer code review easier.
  • Portability and integration: Code that follows established standards is easier to integrate with other systems or libraries, since there is a degree of assurance about quality and compatibility.
  • Scalability: Well-organized code is generally more scalable. It can be extended or modified to meet new requirements or features without a complete rewrite.
  • Performance: Although formalism is not directly tied to code performance, well-structured code is often more optimized and efficient, because it is simpler to spot and fix bottlenecks.
  • Security: Following coding standards can also contribute to code security, since many vulnerabilities result from poor or non-standard coding practices.

    Good formalism in software coding is crucial for the quality, durability, maintainability and efficiency of software development.

Why put clear headers with a license in the code of an Odoo module?

Putting correct headers with the license in the code of an Odoo module is important for several reasons, particularly in the context of open source software such as Odoo:

  • License clarification: License headers state clearly under which license the module is distributed. They inform users and developers of the rights and restrictions attached to using, modifying and redistributing the code.
  • Legal compliance: Respecting license requirements is a matter of legal compliance. By including the license header, you make sure you comply with the terms of the license under which Odoo and its modules are distributed. This can help avoid potential legal disputes related to copyright and intellectual property.
  • Standardization and professionalism: License headers are standard practice in open source software development. Including them reflects professionalism and respect for the standards established in the software development community.
  • Traceability and attribution: License headers and author information contribute to code traceability. They make it possible to identify the original contributors and acknowledge their work, which is particularly important in the open source community, where collaboration and credit are valued.
  • Managing external contributions: If you accept external contributions to your Odoo module, license headers help ensure that all contributors agree with the license under which their code will be distributed.
  • Clarity for users and developers: For companies and developers who use or modify your module, license headers provide the necessary clarity on how they can legally use your code.

Including correct license headers in the code of an Odoo module is an essential practice to ensure legal compliance, maintain professional standards, and facilitate collaboration and ethical use within the open source community. Every service provider should build its own header templates to be efficient.

So how do you do it?

The simplest approach is to follow the OCA (Odoo Community Association) guidelines, which are effective. There is no need to reinvent the wheel.

in Blog
Odoo code: why formal structure matters in a module
ANOR, Cyrille de LAMBERT November 10, 2023
Share this post
Tags
Our blogs

Updated on 04/01/2026

A question about your project? Talk to a consultant.

Book 30 minutes