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 openerp.osv import orm, fields
23
from openerp.addons.decimal_precision import decimal_precision as dp
24
from unidecode import unidecode
27
class banking_export_sepa(orm.Model):
29
_name = 'banking.export.sepa'
30
_description = __doc__
31
_rec_name = 'filename'
33
def _generate_filename(self, cr, uid, ids, name, arg, context=None):
35
for sepa_file in self.browse(cr, uid, ids, context=context):
36
ref = sepa_file.payment_order_ids[0].reference
38
label = unidecode(ref.replace('/', '-'))
41
res[sepa_file.id] = 'sct_%s.xml' % label
45
'payment_order_ids': fields.many2many(
47
'account_payment_order_sepa_rel',
48
'banking_export_sepa_id', 'account_order_id',
51
'nb_transactions': fields.integer(
52
'Number of Transactions', readonly=True),
53
'total_amount': fields.float(
54
'Total Amount', digits_compute=dp.get_precision('Account'),
56
'batch_booking': fields.boolean(
57
'Batch Booking', readonly=True,
58
help="If true, the bank statement will display only one debit "
59
"line for all the wire transfers of the SEPA XML file ; "
60
"if false, the bank statement will display one debit line "
61
"per wire transfer of the SEPA XML file."),
62
'charge_bearer': fields.selection([
63
('SLEV', 'Following Service Level'),
65
('CRED', 'Borne by Creditor'),
66
('DEBT', 'Borne by Debtor'),
67
], 'Charge Bearer', readonly=True,
68
help="Following service level : transaction charges are to be "
69
"applied following the rules agreed in the service level and/or "
70
"scheme (SEPA Core messages must use this). Shared : "
71
"transaction charges on the creditor side are to be borne by "
72
"the creditor, transaction charges on the debtor side are to "
73
"be borne by the debtor. Borne by creditor : all transaction "
74
"charges are to be borne by the creditor. Borne by debtor : "
75
"all transaction charges are to be borne by the debtor."),
76
'create_date': fields.datetime('Generation Date', readonly=True),
77
'file': fields.binary('SEPA XML File', readonly=True),
78
'filename': fields.function(
79
_generate_filename, type='char', size=256, string='Filename',
81
'state': fields.selection([
84
('done', 'Reconciled'),
85
], 'State', readonly=True),