[6.0] regression: inheriting ir_model_data causes data from 'base' module to be discarded
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Fix Released
|
Medium
|
OpenERP's Framework R&D |
Bug Description
Hello,
sorry to shout that one loudly, but I know that v6 "stable" is about to be release, so I want to make sure you take a look to it:
A change introduced recently in the server (after rev #3224 I think), will now destroy important database records in the update process if you have any object inheriting the ir.model.data object.
Simple code like this one will trigger the bug, it's attached as a "kaboom" module so you can test:
class ir_model_
_inherit = "ir.model.data"
ir_model_data()
After loading such code, if you restart the server with option --update=all --database=
your database will be broken, for instance all your menu will be broken at the next login. You can also see that in the console with logs such as:
[2011-01-17 15:24:43,
[2011-01-17 15:24:43,
[2011-01-17 15:24:43,
[2011-01-17 15:24:44,
[2011-01-17 15:24:44,
[2011-01-17 15:24:44,
[2011-01-17 15:24:44,
[2011-01-17 15:24:44,
...
An important consequence of that bug is that the magentoerpconnect certified module is now broken:
https:/
We really need to override or_model_data in the base_external_
Related branches
Changed in openobject-server: | |
assignee: | nobody → OpenERP's Framework R&D (openerp-dev-framework) |
importance: | High → Medium |
status: | Confirmed → In Progress |
summary: |
- [6.0] critical regression: inheriting ir_model_data will now destroy - your database! + [6.0] regression: inheriting ir_model_data causes data from 'base' + module to be discarded |
A few comments:
The issue occurs because in bin/addons/ base/ir/ ir_model. py,
the self.loads collection doesn't contain everything it should.
Here is the instrumentation of the code I'm using:
@@ -723,9 +725,22 @@
cr.execute( 'select id,name, model,res_ id,module from ir_model_data where module IN (' + module_in + ') and noupdate=%s', modules + [False]) mark[(model, res_id) ] = id mark[(model, res_id) ] = id mark[(model, res_id) ] = id mark[(model, res_id) ] = id
module_in = ",".join(["%s"] * len(modules))
wkf_todo = []
+# print "*********** loads", self.loads
+ for item in self.loads:
+ if (item[0] == unicode('base') or item[0] == 'base'):
+ print "**** in loads:", item
+
for (id, name, model, res_id,module) in cr.fetchall():
if (module,name) not in self.loads:
- self.unlink_
+# self.unlink_
+# print "module", module
+ if module != 'base':
+ #print "****", (module,name)
+ self.unlink_
+ else:
+ self.unlink_
+ print "not in loads: :(module,name)", (module,name)
And then it will print (with kaboom installed): administration_ shortcut' ) low_workflow' ) custom_ action' ) translation' ) translation_ app') translation_ export' )
**** in loads: ('base', 'user_root')
not in loads: :(module,name) (u'base', u'menu_
not in loads: :(module,name) (u'base', u'menu_custom')
not in loads: :(module,name) (u'base', u'next_id_4')
not in loads: :(module,name) (u'base', u'menu_
not in loads: :(module,name) (u'base', u'menu_
not in loads: :(module,name) (u'base', u'menu_config')
not in loads: :(module,name) (u'base', u'menu_
not in loads: :(module,name) (u'base', u'menu_
not in loads: :(module,name) (u'base', u'menu_
not in loads: :(module,name) (u'base', u'menu_users')
not in loads: :(module,name) (u'base', u'menu_security')
not in loads: :(module,name) (u'base', u'menu_management')
not in loads: :(module,name) (u'base', u'reporting_menu')
...
Whereas, without the 'kaboom' module installed, there are dozens of entries in the self.loads collection instead: view_form_ action' ) res_widget' ) event-wopartner -view_tree' ) view_base_ module_ upgrade_ window' ) wizard_ simple_ view') on_form' ) res_widget_ user_group_ user') res_log_ all')
**** in loads: ('base', 'values_
**** in loads: ('base', 'bw')
**** in loads: ('base', 'JPY')
**** in loads: ('base', 'ratePLN')
**** in loads: ('base', 'CRC')
**** in loads: ('base', u'access_
**** in loads: ('base', 'res_partner_
**** in loads: ('base', 'action_
**** in loads: ('base', 'config_
**** in loads: ('base', 'action_res_users')
**** in loads: ('base', 'view_translati
**** in loads: ('base', u'access_
**** in loads: ('base', 'ir_cron_act')
**** in loads: ('base', 'vi')
**** in loads: ('base', u'access_
**** in loads: ('base', 'RON')
**** in loads: ('base', 'sa')
and nothing that is not in self.loads.
I've still not been able to track why this self.loads is empty at update with kaboom installed.
Other remark: if you flag the module kaboom as 'uninstalled' using SQL, your update seems able to restore the menus but this is no long ter...