[IMP] mis_builder: migration script to populate new column root_account
parent
65c95b5a77
commit
a809796c78
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
'name': 'MIS Builder',
|
'name': 'MIS Builder',
|
||||||
'version': '0.1',
|
'version': '0.2',
|
||||||
'category': 'Reporting',
|
'category': 'Reporting',
|
||||||
'summary': """
|
'summary': """
|
||||||
Build 'Management Information System' Reports and Dashboards
|
Build 'Management Information System' Reports and Dashboards
|
||||||
|
|
|
@ -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…
Reference in New Issue