← Back to team overview

credativ team mailing list archive

[Merge] lp:~therp-nl/openupgrade-addons/7.0-fix_move_line_currency into lp:openupgrade-addons

 

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

Requested reviews:
  OpenUpgrade Committers (openupgrade-committers)

For more details, see:
https://code.launchpad.net/~therp-nl/openupgrade-addons/7.0-fix_move_line_currency/+merge/186742
-- 
https://code.launchpad.net/~therp-nl/openupgrade-addons/7.0-fix_move_line_currency/+merge/186742
Your team OpenUpgrade Committers is requested to review the proposed merge of lp:~therp-nl/openupgrade-addons/7.0-fix_move_line_currency into lp:openupgrade-addons.
=== modified file 'account/migrations/7.0.1.1/pre-migration.py'
--- account/migrations/7.0.1.1/pre-migration.py	2013-09-09 20:56:30 +0000
+++ account/migrations/7.0.1.1/pre-migration.py	2013-09-20 10:30:53 +0000
@@ -45,7 +45,25 @@
     ('account.account_payment_term_15days', 'account.account_payment_term'),
     ]
 
+def fix_move_line_currency(cr):
+    """
+    In OpenERP 7.0, there is a new constraint on move lines
+    having their currency set to the company currency.
+    These would be happily created in OpenERP 6.1, specifically
+    from bank statements.
+    """
+    openupgrade.logged_query(
+        cr,
+        """
+        UPDATE account_move_line l
+        SET currency_id = NULL
+        FROM res_company c
+        WHERE l.company_id = c.id
+              AND l.currency_id = c.currency_id;
+        """)
+
 @openupgrade.migrate()
 def migrate(cr, version):
     openupgrade.rename_columns(cr, column_renames)
     openupgrade.rename_xmlids(cr, xmlid_renames)
+    fix_move_line_currency(cr)


Follow ups