← Back to team overview

credativ team mailing list archive

lp:~therp-nl/openupgrade-addons/6.1-prevent_automatic_chart_install into lp:openupgrade-addons

 

Stefan Rijnhart (Therp) has proposed merging lp:~therp-nl/openupgrade-addons/6.1-prevent_automatic_chart_install into lp:openupgrade-addons.

Requested reviews:
  OpenUpgrade Committers (openupgrade-committers)

For more details, see:
https://code.launchpad.net/~therp-nl/openupgrade-addons/6.1-prevent_automatic_chart_install/+merge/134702
-- 
https://code.launchpad.net/~therp-nl/openupgrade-addons/6.1-prevent_automatic_chart_install/+merge/134702
Your team OpenUpgrade Committers is requested to review the proposed merge of lp:~therp-nl/openupgrade-addons/6.1-prevent_automatic_chart_install into lp:openupgrade-addons.
=== modified file 'account/migrations/6.1.1.1/pre-migration.py'
--- account/migrations/6.1.1.1/pre-migration.py	2012-06-19 09:34:23 +0000
+++ account/migrations/6.1.1.1/pre-migration.py	2012-11-16 16:17:25 +0000
@@ -27,6 +27,32 @@
 logger = logging.getLogger('OpenUpgrade')
 me = __file__
 
+def prevent_account_installer(cr):
+    """
+    If the account installer has not run, e.g. 
+    after manual installation of account chart
+    and if the company country is set, the 
+    account module will install a random
+    chart on upgrading...
+    """
+    cr.execute("""
+        SELECT id
+        FROM ir_actions_todo
+        WHERE state = 'open'
+            AND id IN (
+            SELECT res_id
+            FROM ir_model_data
+            WHERE name = 'account_configuration_installer_todo'
+            AND module = 'account')
+    """)
+    row = cr.fetchone()
+    if row:
+        cr.execute("""
+            UPDATE ir_actions_todo
+            SET state = 'done'
+            WHERE id = %s
+        """, (row[0],))
+
 def migrate(cr, version):
     try:
         logger.info("%s called", me)
@@ -55,6 +81,7 @@
         else:
             logger.info("%s: account type table, column report type"
                         "has already been preserved", me)
+        prevent_account_installer(cr)
 
     except Exception, e:
         raise osv.except_osv("OpenUpgrade", '%s: %s' % (me, e))


Follow ups