1
##############################################################################
3
# SEPA Credit Transfer module for OpenERP
4
# Copyright (C) 2010-2013 Akretion (http://www.akretion.com)
5
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
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
##############################################################################
22
from osv import osv, fields
24
from tools.translate import _
25
import decimal_precision as dp
28
class banking_export_sepa(osv.osv):
30
_name = 'banking.export.sepa'
31
_description = __doc__
32
_rec_name = 'msg_identification'
34
def _generate_filename(self, cr, uid, ids, name, arg, context=None):
36
for sepa_file in self.browse(cr, uid, ids, context=context):
37
res[sepa_file.id] = 'sepa_' + (sepa_file.msg_identification or '') + '.xml'
41
'payment_order_ids': fields.many2many(
43
'account_payment_order_sepa_rel',
44
'banking_export_sepa_id', 'account_order_id',
47
'prefered_exec_date': fields.date('Prefered execution date', readonly=True),
48
'nb_transactions': fields.integer('Number of transactions', readonly=True),
49
'total_amount': fields.float('Total amount',
50
digits_compute=dp.get_precision('Account'), readonly=True),
51
'msg_identification': fields.char('Message identification', size=35,
53
'batch_booking': fields.boolean('Batch booking', readonly=True,
54
help="If true, the bank statement will display only one debit line for all the wire transfers of the SEPA XML file ; if false, the bank statement will display one debit line per wire transfer of the SEPA XML file."),
55
'charge_bearer': fields.selection([
57
('CRED', 'Borne by creditor'),
58
('DEBT', 'Borne by debtor'),
59
('SLEV', 'Following service level'),
60
], 'Charge bearer', readonly=True,
61
help='Shared : transaction charges on the sender side are to be borne by the debtor, transaction charges on the receiver side are to be borne by the creditor (most transfers use this). Borne by creditor : all transaction charges are to be borne by the creditor. Borne by debtor : all transaction charges are to be borne by the debtor. Following service level : transaction charges are to be applied following the rules agreed in the service level and/or scheme.'),
62
'generation_date': fields.datetime('Generation date',
64
'file': fields.binary('SEPA XML file', readonly=True),
65
'filename': fields.function(_generate_filename, type='char', size=256,
66
method=True, string='Filename', readonly=True),
67
'state': fields.selection([
70
('done', 'Reconciled'),
71
], 'State', readonly=True),
75
'generation_date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),