Skip to content

Commit

Permalink
[IMP] account_analytic_parent: OpenUpgrade migration script
Browse files Browse the repository at this point in the history
For restoring the visibility of analytic accounts of type='view', which
are very tighted with analytic accounts that are parents of another account.
  • Loading branch information
pedrobaeza committed Aug 9, 2017
1 parent 14599cc commit 4d21d94
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions account_analytic_parent/migrations/9.0.1.0.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(cr, version):
"""Restores visibility of accounts of type='view'. They are not exactly
the same as parent accounts, but both values are very tighted"""
openupgrade.logged_query(
cr,
"""UPDATE account_analytic_account SET account_type='normal'
WHERE %s = 'view' AND %s NOT IN ('cancelled', 'close')
""" % (
openupgrade.get_legacy_name('type'),
openupgrade.get_legacy_name('state'),
)
)

0 comments on commit 4d21d94

Please sign in to comment.