Merge lp:~therp-nl/openupgrade-addons/6.0_add_default_company_id_account_period into lp:openupgrade-addons/6.0

Proposed by Holger Brunn (Therp) on 2012-07-29
Status: Merged
Merged at revision: 4786
Proposed branch: lp:~therp-nl/openupgrade-addons/6.0_add_default_company_id_account_period
Merge into: lp:openupgrade-addons/6.0
Diff against target: 13 lines (+5/-1)
1 file modified
account/migrations/6.0.1.1/pre-migration.py (+5/-1)
To merge this branch: bzr merge lp:~therp-nl/openupgrade-addons/6.0_add_default_company_id_account_period
Reviewer Review Type Date Requested Status
Stefan Rijnhart (Opener) 2012-07-29 Approve on 2012-07-29
Review via email: mp+117190@code.launchpad.net

Description of the change

I don't like this patch, but given that in openerp's upgrade procedure the defaults for account_move are pulled before the ones for account_fiscalyear (from which in turn account_period gets its company_id), I don't see another solution.

To post a comment you must log in.

Agreed. Well done.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/migrations/6.0.1.1/pre-migration.py'
2--- account/migrations/6.0.1.1/pre-migration.py 2012-06-07 14:51:52 +0000
3+++ account/migrations/6.0.1.1/pre-migration.py 2012-07-29 18:01:24 +0000
4@@ -45,4 +45,8 @@
5 # changes data type of one of the columns
6 sql.drop_view_if_exists(cr, 'report_invoice_created')
7 mgr_refund_journal_type(cr)
8-
9+ # company of account_period needs to be updated before defaults
10+ # are applied
11+ cr.execute('alter table account_period add column company_id integer')
12+ cr.execute('update account_period set company_id=(select '+
13+ 'company_id from res_users where id=account_period.create_uid)')

Subscribers

People subscribed via source and target branches