1 # -*- encoding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 ##############################################################################
23 from osv import fields,osv
25 def _code_get(self, cr, uid, context={}):
26 acc_type_obj = self.pool.get('account.account.type')
27 ids = acc_type_obj.search(cr, uid, [])
28 res = acc_type_obj.read(cr, uid, ids, ['code', 'name'], context)
29 return [(r['code'], r['name']) for r in res]
32 class report_account_receivable(osv.osv):
33 _name = "report.account.receivable"
34 _description = "Receivable accounts"
37 'name': fields.char('Week of Year', size=7, readonly=True),
38 'type': fields.selection(_code_get, 'Account Type', required=True),
39 'balance':fields.float('Balance', readonly=True),
40 'debit':fields.float('Debit', readonly=True),
41 'credit':fields.float('Credit', readonly=True),
46 create or replace view report_account_receivable as (
49 to_char(date,'YYYY:IW') as name,
50 sum(l.debit-l.credit) as balance,
51 sum(l.debit) as debit,
52 sum(l.credit) as credit,
57 account_account a on (l.account_id=a.id)
61 to_char(date,'YYYY:IW'), a.type
63 report_account_receivable()
65 #a.type in ('receivable','payable')
68 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: