2010-04-22 07:20:09 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
##############################################################################
|
|
|
|
#
|
|
|
|
# OpenERP, Open Source Management Solution
|
|
|
|
# Copyright (C) 2004-2010 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
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
import time
|
|
|
|
|
|
|
|
from osv import osv, fields
|
|
|
|
from tools.translate import _
|
|
|
|
|
|
|
|
class account_balance_report(osv.osv_memory):
|
2010-06-25 13:18:49 +00:00
|
|
|
|
|
|
|
_inherit = "account.common.report"
|
2010-04-22 07:20:09 +00:00
|
|
|
_name = 'account.balance.report'
|
|
|
|
_description = 'Account Balance Report'
|
|
|
|
_columns = {
|
2010-06-25 13:18:49 +00:00
|
|
|
'company_id': fields.many2one('res.company', 'Company', required=True),
|
|
|
|
'display_account': fields.selection([('bal_mouvement','With movements'),
|
2010-04-22 07:20:09 +00:00
|
|
|
('bal_all','All'),
|
|
|
|
('bal_solde','With balance is not equal to 0'),
|
|
|
|
],'Display accounts'),
|
2010-06-25 13:18:49 +00:00
|
|
|
}
|
2010-04-22 07:20:09 +00:00
|
|
|
|
|
|
|
|
2010-06-25 13:18:49 +00:00
|
|
|
def default_get(self, cr, uid, fields, context):
|
|
|
|
""" To get default values for the object.
|
|
|
|
@param self: The object pointer.
|
|
|
|
@param cr: A database cursor
|
|
|
|
@param uid: ID of the user currently logged in
|
|
|
|
@param fields: List of fields for which we want default values
|
|
|
|
@param context: A standard dictionary
|
|
|
|
@return: A dictionary which of fields with values.
|
|
|
|
"""
|
|
|
|
res = {}
|
2010-06-25 13:29:02 +00:00
|
|
|
if 'journal_ids' in fields:# FIX me!!
|
2010-06-25 13:18:49 +00:00
|
|
|
res['journal_ids'] = []
|
|
|
|
return res
|
2010-04-22 07:20:09 +00:00
|
|
|
else:
|
2010-06-25 13:18:49 +00:00
|
|
|
result = super(account_balance_report, self).default_get(cr, uid, fields, context)
|
|
|
|
result.update({'company_id':self.pool.get('account.account').read(cr, uid, result['chart_account_id'], context=context)['company_id']})
|
|
|
|
return result
|
2010-04-22 07:20:09 +00:00
|
|
|
|
2010-06-25 13:18:49 +00:00
|
|
|
def _print_report(self, cr, uid, ids, data, query_line, context=None):
|
2010-04-22 07:20:09 +00:00
|
|
|
|
2010-06-25 13:18:49 +00:00
|
|
|
if data['model']=='ir.ui.menu':
|
|
|
|
data['ids']=data['form']['chart_account_id']
|
|
|
|
data['form'].update(self.read(cr, uid, ids, ['display_account', 'company_id',])[0])
|
|
|
|
data['form']['query_get'] = query_line
|
|
|
|
return { 'type': 'ir.actions.report.xml', 'report_name': 'account.account.balance', 'datas': data, 'nodestroy':True, }
|
|
|
|
account_balance_report()
|