Browse Source

[IMP] mis_builder: migration script to populate new column root_account

pull/90/head
Stéphane Bidoul 9 years ago
parent
commit
1d04f6b269
  1. 2
      mis_builder/__openerp__.py
  2. 41
      mis_builder/migrations/8.0.0.2/pre-migration.py

2
mis_builder/__openerp__.py

@ -24,7 +24,7 @@
{
'name': 'MIS Builder',
'version': '0.1',
'version': '0.2',
'category': 'Reporting',
'summary': """
Build 'Management Information System' Reports and Dashboards

41
mis_builder/migrations/8.0.0.2/pre-migration.py

@ -0,0 +1,41 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# mis_builder module for Odoo, Management Information System Builder
# Copyright (C) 2014-2015 ACSONE SA/NV (<http://acsone.eu>)
#
# This file is a part of mis_builder
#
# mis_builder is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License v3 or later
# as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# mis_builder is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License v3 or later for more details.
#
# You should have received a copy of the GNU Affero General Public License
# v3 or later along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
def migrate(cr, version):
if not version:
return
cr.execute("""
ALTER TABLE mis_report_instance
ADD COLUMN root_account INTEGER
""")
cr.execute("""
UPDATE mis_report_instance
SET root_account = (
SELECT id FROM account_account
WHERE parent_id IS NULL
AND company_id = mis_report_instance.company_id
LIMIT 1
)
""")
Loading…
Cancel
Save