diff --git a/account_banking_sepa_credit_transfer/__openerp__.py b/account_banking_sepa_credit_transfer/__openerp__.py index 6e5a69fbd..aedf60b90 100644 --- a/account_banking_sepa_credit_transfer/__openerp__.py +++ b/account_banking_sepa_credit_transfer/__openerp__.py @@ -22,7 +22,7 @@ { 'name': 'Account Banking SEPA Credit Transfer', 'summary': 'Create SEPA XML files for Credit Transfers', - 'version': '0.2', + 'version': '0.3', 'license': 'AGPL-3', 'author': "Akretion, " "Serv. Tecnol. Avanzados - Pedro M. Baeza, " diff --git a/account_banking_sepa_credit_transfer/migrations/8.0.0.3/post-migration.py b/account_banking_sepa_credit_transfer/migrations/8.0.0.3/post-migration.py new file mode 100644 index 000000000..58c5831f0 --- /dev/null +++ b/account_banking_sepa_credit_transfer/migrations/8.0.0.3/post-migration.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2015 Akretion (http://www.akretion.com/) +# @author: Alexis de Lattre +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import pooler, SUPERUSER_ID + + +def migrate(cr, version): + if not version: + return + + pool = pooler.get_pool(cr.dbname) + cr.execute(''' + SELECT + old_sepa.file, + rel.account_order_id AS payment_order_id, + payment_order.reference + FROM migration_banking_export_sepa old_sepa + LEFT JOIN migration_account_payment_order_sepa_rel rel + ON old_sepa.id=rel.banking_export_sepa_id + LEFT JOIN payment_order ON payment_order.id=rel.account_order_id + ''') + + for sepa_file in cr.dictfetchall(): + filename = 'sct_%s.xml' % sepa_file['reference'].replace('/', '-') + pool['ir.attachment'].create( + cr, SUPERUSER_ID, { + 'name': filename, + 'res_id': sepa_file['payment_order_id'], + 'res_model': 'payment.order', + 'datas': str(sepa_file['file']), + }) + return diff --git a/account_banking_sepa_credit_transfer/migrations/8.0.0.3/pre-migration.py b/account_banking_sepa_credit_transfer/migrations/8.0.0.3/pre-migration.py new file mode 100644 index 000000000..f1f5f7b0f --- /dev/null +++ b/account_banking_sepa_credit_transfer/migrations/8.0.0.3/pre-migration.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2015 Akretion (http://www.akretion.com/) +# @author: Alexis de Lattre +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +def migrate(cr, version): + if not version: + return + + cr.execute( + 'ALTER TABLE banking_export_sepa ' + 'RENAME TO migration_banking_export_sepa') + cr.execute( + 'ALTER TABLE account_payment_order_sepa_rel ' + 'RENAME TO migration_account_payment_order_sepa_rel') diff --git a/account_banking_sepa_direct_debit/__openerp__.py b/account_banking_sepa_direct_debit/__openerp__.py index e57209eff..bf622c44c 100644 --- a/account_banking_sepa_direct_debit/__openerp__.py +++ b/account_banking_sepa_direct_debit/__openerp__.py @@ -22,7 +22,7 @@ { 'name': 'Account Banking SEPA Direct Debit', 'summary': 'Create SEPA files for Direct Debit', - 'version': '0.1', + 'version': '0.2', 'license': 'AGPL-3', 'author': "Akretion, " "Serv. Tecnol. Avanzados - Pedro M. Baeza, " diff --git a/account_banking_sepa_direct_debit/migrations/8.0.0.2/post-migration.py b/account_banking_sepa_direct_debit/migrations/8.0.0.2/post-migration.py new file mode 100644 index 000000000..dd759cac6 --- /dev/null +++ b/account_banking_sepa_direct_debit/migrations/8.0.0.2/post-migration.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2015 Akretion (http://www.akretion.com/) +# @author: Alexis de Lattre +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import pooler, SUPERUSER_ID + + +def migrate(cr, version): + if not version: + return + + pool = pooler.get_pool(cr.dbname) + cr.execute(''' + SELECT + old_sepa.file, + rel.account_order_id AS payment_order_id, + payment_order.reference + FROM migration_banking_export_sdd old_sepa + LEFT JOIN migration_account_payment_order_sdd_rel rel + ON old_sepa.id=rel.banking_export_sepa_id + LEFT JOIN payment_order ON payment_order.id=rel.account_order_id + ''') + + for sepa_file in cr.dictfetchall(): + filename = 'sdd_%s.xml' % sepa_file['reference'].replace('/', '-') + pool['ir.attachment'].create( + cr, SUPERUSER_ID, { + 'name': filename, + 'res_id': sepa_file['payment_order_id'], + 'res_model': 'payment.order', + 'datas': str(sepa_file['file']), + }) + return diff --git a/account_banking_sepa_direct_debit/migrations/8.0.0.2/pre-migration.py b/account_banking_sepa_direct_debit/migrations/8.0.0.2/pre-migration.py new file mode 100644 index 000000000..42fa23b0a --- /dev/null +++ b/account_banking_sepa_direct_debit/migrations/8.0.0.2/pre-migration.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2015 Akretion (http://www.akretion.com/) +# @author: Alexis de Lattre +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program 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 for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +def migrate(cr, version): + if not version: + return + + cr.execute( + 'ALTER TABLE banking_export_sdd ' + 'RENAME TO migration_banking_export_sdd') + cr.execute( + 'ALTER TABLE account_payment_order_sdd_rel ' + 'RENAME TO migration_account_payment_order_sdd_rel')