1
# -*- coding: utf-8 -*-
2
##############################################################################
4
# Author: Alexandre Fayolle
5
# Copyright 2014 Camptocamp SA
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.
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.
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/>.
20
##############################################################################
24
logger = logging.getLogger('openerp.upgrade')
27
def migrate(cr, version):
28
logger.info('Migrating product_procurement_type_dropshipping')
29
query = ("UPDATE product_template AS pt "
30
"SET procurement_type=%(procurement_type)s "
31
"FROM product_supplierinfo AS psi "
32
"WHERE procure_method=%(procure_method)s "
33
" AND supply_method=%(supply_method)s "
34
" AND psi.product_id = pt.id "
35
" AND psi.direct_delivery_flag = true")
36
fixes = [{'procurement_type': 'direct_delivery', 'procure_method': 'make_to_order', 'supply_method': 'buy'},
39
cr.execute(query, fix)