1
##############################################################################
3
# Copyright (C) 2009 EduSense BV (<http://www.edusense.nl>).
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
19
##############################################################################
21
from osv import osv, fields
22
from datetime import date
23
from tools.translate import _
25
class payment_order(osv.osv):
27
Attach export_clieop wizard to payment order and allow traceability
29
_inherit = 'payment.order'
30
def get_wizard(self, type):
31
if type in ['CLIEOPPAY', 'CLIEOPINC', 'CLIEOPSAL']:
32
return self._module, 'wizard_account_banking_export_clieop'
33
return super(payment_order, self).get_wizard(type)
36
class clieop_export(osv.osv):
38
_name = 'banking.export.clieop'
39
_description = __doc__
43
fields.text('Payment Orders'),
45
fields.selection([('T', _('Yes')), ('P', _('No'))],
46
'Test Run', readonly=True),
48
fields.integer('ClieOp Transaction nr of the Day', readonly=True),
50
fields.integer('Number of Duplicates', readonly=True),
52
fields.date('Prefered Processing Date',readonly=True),
54
fields.integer('Number of Transactions', readonly=True),
56
fields.char('Check Number Accounts', size=5, readonly=True),
58
fields.float('Total Amount', readonly=True),
60
fields.char('Identification', size=6, readonly=True, select=True),
63
('CREDBET', 'Payment Batch'),
64
('SALARIS', 'Salary Payment Batch'),
65
('INCASSO', 'Direct Debit Batch'),
66
], 'File Type', size=7, readonly=True, select=True),
68
fields.datetime('Generation Date', readonly=True, select=True),
70
fields.binary('ClieOp File', readonly=True),
75
('done', 'Reconciled'),
76
], 'State', readonly=True),
78
def _get_daynr(self, cursor, uid, ids, context):
80
Return highest day number
82
last = cursor.execute('SELECT max(daynumber) '
83
'FROM banking_export_clieop '
84
'WHERE date_generated = "%s"' %
85
date.today().strftime('%Y-%m-%d')
92
'date_generated': lambda *a: date.today().strftime('%Y-%m-%d'),
93
'duplicates': lambda *a: 1,
94
'state': lambda *a: 'draft',
95
'daynumber': _get_daynr,
99
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: