Odoo Help

Welcome!

This community 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.

0

how to get modules dependencies

By
Tarek Mohamed Ibrahim
on 5/19/15, 1:20 AM 575 views

Hi,

I needed to get the modules dependecies showing all levels

I wrote the following code that shows only the first level, assuming that I have the list of modules in the list 'modules'

I tried to show all dependencies using a recursive function with no success, could anyone help me accomplishing this

Here is my code

def get_dep(m):
    fl = main_path+m+'\\__openerp__.py'
    ret = []
    with open(fl,'r') as f:
        ret = eval(f.read())['depends']
    return ret

main_path = 'D:\\openerp-7.0-latest\\openerp-7.0-20140804-231303\\openerp\\addons\\'
modules = [
    'account_budget',
    'base',
    'purchase',   
]


for m in modules:
    print m
    for f in get_dep(m):
        print '         '+f

 

The above code works fine it shows all the depends modules.

Prakash
on 5/19/15, 1:43 AM

It gave me the result : account_budget account base purchase stock process procurement but the 'stock' module depends on 'product', I need a help in tweaking the code so it prints all levels

Tarek Mohamed Ibrahim
on 5/22/15, 3:25 AM
0

Prakash

--Prakash--
3173
| 5 4 7
Bikaner, India
--Prakash--

OpenERP Devloper at SunARC Technology

Prakash
On 5/22/15, 8:34 AM

Try the below code:-

ret = []

def get_dep(m):
global ret
fl = main_path+m+'\\__openerp__.py'
with open(fl,'r') as f:
ret = eval(f.read())['depends']
return ret

main_path = 'D:\\openerp-7.0-latest\\openerp-7.0-20140804-231303\\openerp\\addons\\'

modules = [
'account_budget',
'base',
'purchase',
]

def display(module):
for m in module:
print m
for f in get_dep(m):
print ' '+f
display(modules)



vals = [display(ret) for _ in range(3)] # It prints 3 level based on your need increase the value

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/19/15, 1:20 AM
Seen: 575 times
Last updated: 6/10/15, 5:52 AM