~akretion-team/banking-addons/70-fully-handle-payment-types

« back to all changes in this revision

Viewing changes to account_banking_payment_export/migrations/7.0.0.1.165/pre-migration.py

  • Committer: Alexis de Lattre
  • Date: 2014-06-23 09:47:01 UTC
  • mfrom: (225.1.35 7.0)
  • Revision ID: alexis@via.ecp.fr-20140623094701-ct36uyuqp73w0vmv
[MERGE] with trunk revno 260.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
##############################################################################
 
3
#
 
4
#    Copyright (C) 2014 Akretion (http://www.akretion.com/)
 
5
#    @author: Alexis de Lattre <alexis.delattre@akretion.com>
 
6
#
 
7
#    This program is free software: you can redistribute it and/or modify
 
8
#    it under the terms of the GNU Affero General Public License as
 
9
#    published by the Free Software Foundation, either version 3 of the
 
10
#    License, or (at your option) any later version.
 
11
#
 
12
#    This program is distributed in the hope that it will be useful,
 
13
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
#    GNU Affero General Public License for more details.
 
16
#
 
17
#    You should have received a copy of the GNU Affero General Public License
 
18
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
#
 
20
##############################################################################
 
21
 
 
22
 
 
23
def migrate(cr, version):
 
24
    if not version:
 
25
        return
 
26
    cr.execute(
 
27
        "UPDATE payment_line SET communication = communication2, "
 
28
        "communication2 = null "
 
29
        "FROM payment_order "
 
30
        "WHERE payment_line.order_id = payment_order.id "
 
31
        "AND payment_order.state in ('draft', 'open') "
 
32
        "AND payment_line.state = 'normal' "
 
33
        "AND communication2 is not null")