Odoo Help


How to define priority of independent modules to ensure one is loaded before the second one?

Yannick Vaucher - Camptocamp
on 6/13/13, 3:20 PM 1,773 views

Sometimes, you have 2 modules acting on the same view but which can act interdependently.

And when one of those modules start to redefine completely the view or mode commonly delete an element of the view, there are some trouble in compatibility.

However, in most case you could find a way to install both without issue.

But then you push the dangerous update button of one module and not the other or try a base update, and there everything is stuck because of some issue like, the module B cannot find the attribute of the field X because module A removed it. But if you had installed the module A before the module B it would work.

How can we settle this kind of issue to make more compatibility between modules?

Is there a way to make sure a view of a module is loaded before the other? Moreover is there a way to check if an other module is installed and if so do some different behaviors?

Setting in __openerp__.py a module as a dependency is not a solution as it would force its install and we don't want that to happen.

Royal Administrator
On 1/18/17, 4:23 PM

I would be interested as to what folks think about this patch to 9.0 openerp/modules/graph.py def add_modules, right before the line that starts "dependencies =".

The idea is that you add always_extends = ['module1', 'module2'] to the __openerp__.py of a 'new_module'.  Every other module that depends on module1 or module2 will also be treated as being dependent on new_module, which forces new_module to load before any other dependencies of module1 or module2.

I have found this useful especially when I am trying to insert a module in between existing ones.

Thoughts?  Did I do a good thing here?


        # jrook begin adding always_extends

raw_packages = packages
packages = []
extend_depends = {}

for p, info in raw_packages:
extend_depends[p] = []

for p, info in raw_packages:
always_extends = info.get('always_extends') or []
for extend in always_extends:
if extend in info['depends']:
for p2, info2 in raw_packages:
if p2 != p and extend in info2['depends']: # if another module depends on this always_extend
extend_depends[p2].append(p) # then treat other module as depending on this module also

for p, info in raw_packages:
info['depends'] = info['depends'] + extend_depends[p]
packages.append((p, info))

# jrook done adding always_extends

That's it.  Add to your graph.py, and use 'always_depends' in your __openerp__.py's.


Ray Carnes

--Ray Carnes--
| 9 7 9
Keyport, United States
--Ray Carnes--

Senior ERP Analyst

OpenERP 6.1, 7.0; Odoo 8.0, 9.0, 10.0 and 11.0.

Completed Odoo Functional and Technical Training.

Functional Areas:

  • CRM/Sales

  • Inventory

  • Manufacturing

  • Accounting

  • Purchasing

Major Skills:

  • Business Process Reengineering

  • Efficiency Consulting

  • User Needs and GAP Analysis;

  • Functional and Technical Design;

  • Prototyping and Proof of Concepts;

  • Requirements Specifications;

  • Agile Implementation;

  • Data Migration;

  • Configuration & Customization (UI and code);

  • Integration - Odoo and non Odoo Applications and Services;

  • Training and Knowledge Transfer;

  • Go Live Support;

  • Helpdesk;

  • Version Upgrades and Migration.

  • Accounting Expert.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

I am a skilled Communicator and I only take the serious things seriously!

Ray Carnes
On 1/2/17, 11:44 AM

View priority (sequence) defines the order of application during view inheritance:

View matching

  • if a view is requested by (model, type), the view with the right model and type, mode=primary and the lowest priority is matched

  • when a view is requested by id, if its mode is not primary its closest parent with mode primary is matched

View resolution

Resolution generates the final arch for a requested/matched primary view:

  1. if the view has a parent, the parent is fully resolved then the current view's inheritance specs are applied

  2. if the view has no parent, its arch is used as-is

  3. the current view's children with mode extension are looked up and their inheritance specs are applied depth-first (a child view is applied, then its children, then its siblings)

The result of applying children views yields the final arch


About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 6/13/13, 3:20 PM
Seen: 1773 times
Last updated: 1/18/17, 4:23 PM