summaryrefslogtreecommitdiff
path: root/openerp/modules/db.py
diff options
context:
space:
mode:
authorStephane Wirtel <stw@openerp.com>2011-09-29 13:55:15 +0200
committerStephane Wirtel <stw@openerp.com>2011-09-29 13:55:15 +0200
commitccfcb47149feebb74d5cb98d454d0c0528acfc36 (patch)
tree98470f1ccc1f580f7d92c76f0dc4e276e34479b8 /openerp/modules/db.py
parentd159b7b18292ab990351ae2e2e4944e0d251a512 (diff)
[IMP] base: each ir.module.category will be assigned with an
autogenerated xml-id during the creation of the database [IMP] base: Create the records for the categories of OpenERP bzr revid: stw@openerp.com-20110929115515-rqlwqfzndxblxqtz
Diffstat (limited to 'openerp/modules/db.py')
-rw-r--r--openerp/modules/db.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/openerp/modules/db.py b/openerp/modules/db.py
index 6e6dd64b13c..e621564076f 100644
--- a/openerp/modules/db.py
+++ b/openerp/modules/db.py
@@ -102,7 +102,9 @@ def create_categories(cr, categories):
"""
p_id = None
+ category = []
while categories:
+ category.append(categories[0])
if p_id is not None:
cr.execute('SELECT id \
FROM ir_module_category \
@@ -117,6 +119,9 @@ def create_categories(cr, categories):
(name, parent_id) \
VALUES (%s, %s) RETURNING id', (categories[0], p_id))
c_id = cr.fetchone()[0]
+ xml_id = 'module_category_' + ('_'.join(map(lambda x: x.lower(), category))).replace('&', 'and').replace(' ', '_')
+ cr.execute('INSERT INTO ir_model_data (module, name, res_id, model) \
+ VALUES (%s, %s, %s, %s)', ('base', xml_id, c_id, 'ir.module.category'))
else:
c_id = c_id[0]
p_id = c_id