openupgrade-drivers team mailing list archive
-
openupgrade-drivers team
-
Mailing list archive
-
Message #00198
Re: update_module_names questions on usage
On 22-10-13 18:55, Sandy Carter wrote:
If I were to add all the related modules from mgmtsystem that were
renamed wiki*->document*, I would be doubling the size of module_namespec
and this is just when migrating wiki_environment_manual.
Hi Sandy,
honestly, I could not care less how long this list is going to be. I
still think it is a perfectly valid solution.
This doesn't seem clean, I would expect OpenUpgrade to run pre-migration
scripts (and renames) before adding available 7.0 modules as new.
No, the OpenERP migration manager does not do that and it seems a pretty
bad idea to me if every newly added module to the module path runs a
script on your database. The only thing remotely similar that I ever
wished it would do is run a pre-install script but only if a module was
actually going to be installed, so that would not solve your problem here.
(BTW I say 'OpenERP migration manager' because running migration scripts
is core OpenERP functionality, nothing OpenUpgrade specific. It is
*providing* the migration scripts which is one of the main goals of the
project.)
I tried a little hack to at least remove old module names if they've been
added/renamed already. It fixes some problems by accepting that some modules
may have been renamed or added before update_module_names is called.
I don't know how sane this is.
Looks ok to me!
Cheers,
Stefan.
--- parts/openerp/openerp/openupgrade/openupgrade.py (revision )
+++ parts/openerp/openerp/openupgrade/openupgrade.py (revision )
@@ -343,9 +343,16 @@
:param namespec: tuple of (old name, new name)
"""
for (old_name, new_name) in namespec:
+ query = ("SELECT * FROM ir_module_module "
+ "WHERE name = %s")
+ if logged_query(cr, query, [new_name]):
+ query = ("DELETE FROM ir_module_module "
+ "WHERE name = %s")
+ logged_query(cr, query, [old_name])
+ else:
- query = ("UPDATE ir_module_module SET name = %s "
- "WHERE name = %s")
- logged_query(cr, query, (new_name, old_name))
+ query = ("UPDATE ir_module_module SET name = %s "
+ "WHERE name = %s")
+ logged_query(cr, query, (new_name, old_name))
query = ("UPDATE ir_model_data SET module = %s "
"WHERE module = %s ")
logged_query(cr, query, (new_name, old_name))
--
Therp - Maatwerk in open ontwikkeling
Stefan Rijnhart - Ontwerp en implementatie
mail: stefan@xxxxxxxx
tel: +31 (0) 614478606
web: http://therp.nl
References