1 # -*- encoding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
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 from osv import osv,fields
25 from tools.translate import _
27 class account_coda(osv.osv):
28 _name = "account.coda"
29 _description = "coda for an Account"
31 'name': fields.binary('Coda file', readonly=True, help="Store the detail of bank statements"),
32 'statement_ids': fields.one2many('account.bank.statement', 'coda_id', 'Generated Bank Statements', readonly=True),
33 'note': fields.text('Import log', readonly=True),
34 'journal_id': fields.many2one('account.journal', 'Journal', readonly=True, select=True, help="Bank Journal"),
35 'date': fields.date('Date', readonly=True, select=True, help="Import Date"),
36 'user_id': fields.many2one('res.users', 'User', readonly=True, select=True),
37 'company_id': fields.many2one('res.company', 'Company', readonly=True)
40 'date': time.strftime('%Y-%m-%d'),
41 'user_id': lambda self,cr,uid,context: uid,
42 'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'account.coda', context=c),
45 def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
46 res = super(account_coda, self).search(cr, user, args=args, offset=offset, limit=limit, order=order,
47 context=context, count=count)
48 if context.get('bank_statement', False) and not res:
49 raise osv.except_osv('Error', _('Coda file not found for bank statement !!'))
54 class account_bank_statement(osv.osv):
55 _inherit = "account.bank.statement"
57 'coda_id':fields.many2one('account.coda', 'Coda'),
60 account_bank_statement()
62 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: