TO retrieve all children projects of project ids in project module and return a dictionary mapping each project to appiar its parent.id in parent project in project module (or None)in openerp. use this code given below in .py file in openerp.
def _get_project_and_children(self, cr, uid, ids, context=None):
res = dict.fromkeys(ids, None)
while ids:
cr.execute("""
SELECT project.id, parent.id
FROM project_project project, project_project parent, account_analytic_account account
WHERE project.analytic_account_id = account.id
AND parent.analytic_account_id = account.parent_id
AND parent.id IN %s
""", (tuple(ids),))
dic = dict(cr.fetchall())
res.update(dic)
ids = dic.keys()
return res
0 Comment(s)