credativ team mailing list archive
-
credativ team
-
Mailing list archive
-
Message #05029
lp:~therp-nl/openupgrade-addons/6.1-lp769632-purge_ir_model_data_from_deleted_admin_employee into lp:openupgrade-addons
Stefan Rijnhart (Therp) has proposed merging lp:~therp-nl/openupgrade-addons/6.1-lp769632-purge_ir_model_data_from_deleted_admin_employee into lp:openupgrade-addons.
Requested reviews:
OpenUpgrade Committers (openupgrade-committers)
Related bugs:
Bug #769632 in OpenUpgrade Addons: "Removing Administrator employee record causes future updates of hr module to fail"
https://bugs.launchpad.net/openupgrade-addons/+bug/769632
For more details, see:
https://code.launchpad.net/~therp-nl/openupgrade-addons/6.1-lp769632-purge_ir_model_data_from_deleted_admin_employee/+merge/130095
--
https://code.launchpad.net/~therp-nl/openupgrade-addons/6.1-lp769632-purge_ir_model_data_from_deleted_admin_employee/+merge/130095
Your team OpenUpgrade Committers is requested to review the proposed merge of lp:~therp-nl/openupgrade-addons/6.1-lp769632-purge_ir_model_data_from_deleted_admin_employee into lp:openupgrade-addons.
=== modified file 'hr/migrations/6.1.1.1/pre-migration.py'
--- hr/migrations/6.1.1.1/pre-migration.py 2012-06-19 09:34:23 +0000
+++ hr/migrations/6.1.1.1/pre-migration.py 2012-10-17 11:59:21 +0000
@@ -21,8 +21,27 @@
from openerp.openupgrade import openupgrade
+def purge_resource_ref(cr):
+ """
+ Workaround for https://bugs.launchpad.net/openobject-addons/+bug/769632
+ when the administrator user has been removed
+ """
+ cr.execute("""
+ SELECT COUNT(id) FROM ir_model_data
+ WHERE module = 'hr'
+ AND name = 'employee'"""
+ )
+ if not cr.fetchone()[0]:
+ openupgrade.logged_query(
+ cr, """
+ DELETE FROM ir_model_data
+ WHERE module = 'hr'
+ AND name = 'employee_resource_resource'"""
+ )
+
@openupgrade.migrate()
def migrate(cr, version):
+ purge_resource_ref(cr)
openupgrade.rename_tables(cr, [('hr_employee_marital_status', openupgrade.get_legacy_name('hr_employee_marital_status'))])
openupgrade.rename_columns(cr,
{
Follow ups