2010-05-21 14:48:21 +00:00
|
|
|
# -*- encoding: utf-8 -*-
|
|
|
|
##############################################################################
|
2010-06-18 13:39:57 +00:00
|
|
|
#
|
2010-05-21 14:48:21 +00:00
|
|
|
# OpenERP, Open Source Management Solution
|
|
|
|
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
|
|
|
#
|
|
|
|
# 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
|
2010-06-18 13:39:57 +00:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2010-05-21 14:48:21 +00:00
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
import time
|
2010-08-16 11:44:46 +00:00
|
|
|
|
2010-05-21 14:48:21 +00:00
|
|
|
from osv import osv,fields
|
2010-10-18 12:43:04 +00:00
|
|
|
from tools.translate import _
|
2010-05-21 14:48:21 +00:00
|
|
|
|
|
|
|
class account_coda(osv.osv):
|
|
|
|
_name = "account.coda"
|
|
|
|
_description = "coda for an Account"
|
|
|
|
_columns = {
|
2010-07-06 14:58:03 +00:00
|
|
|
'name': fields.binary('Coda file', readonly=True, help="Store the detail of bank statements"),
|
|
|
|
'statement_ids': fields.one2many('account.bank.statement', 'coda_id', 'Generated Bank Statements', readonly=True),
|
2010-05-21 14:48:21 +00:00
|
|
|
'note': fields.text('Import log', readonly=True),
|
2010-07-06 14:58:03 +00:00
|
|
|
'journal_id': fields.many2one('account.journal', 'Journal', readonly=True, select=True, help="Bank Journal"),
|
2010-06-23 07:32:30 +00:00
|
|
|
'date': fields.date('Date', readonly=True, select=True, help="Import Date"),
|
2010-07-06 14:58:03 +00:00
|
|
|
'user_id': fields.many2one('res.users', 'User', readonly=True, select=True),
|
2010-09-06 05:29:17 +00:00
|
|
|
'company_id': fields.many2one('res.company', 'Company', readonly=True)
|
2010-05-21 14:48:21 +00:00
|
|
|
}
|
|
|
|
_defaults = {
|
2010-06-23 07:51:00 +00:00
|
|
|
'date': time.strftime('%Y-%m-%d'),
|
2010-05-21 14:48:21 +00:00
|
|
|
'user_id': lambda self,cr,uid,context: uid,
|
2010-09-06 05:29:17 +00:00
|
|
|
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'account.coda', context=c),
|
2010-05-21 14:48:21 +00:00
|
|
|
}
|
2010-08-16 11:44:46 +00:00
|
|
|
|
2010-10-18 12:43:04 +00:00
|
|
|
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
|
|
|
|
res = super(account_coda, self).search(cr, user, args=args, offset=offset, limit=limit, order=order,
|
|
|
|
context=context, count=count)
|
|
|
|
if not res:
|
|
|
|
raise osv.except_osv('Error', _('Coda file not found for bank statement !!'))
|
|
|
|
return res
|
|
|
|
|
2010-05-21 14:48:21 +00:00
|
|
|
account_coda()
|
|
|
|
|
|
|
|
class account_bank_statement(osv.osv):
|
|
|
|
_inherit = "account.bank.statement"
|
|
|
|
_columns = {
|
2010-07-06 14:58:03 +00:00
|
|
|
'coda_id':fields.many2one('account.coda', 'Coda'),
|
2010-05-21 14:48:21 +00:00
|
|
|
}
|
2010-08-16 11:44:46 +00:00
|
|
|
|
2010-05-21 14:48:21 +00:00
|
|
|
account_bank_statement()
|
|
|
|
|
2010-07-06 14:58:03 +00:00
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|