2010-06-14 08:48:24 +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/>.
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
from osv import fields, osv
|
|
|
|
|
|
|
|
class account_report_general_ledger(osv.osv_memory):
|
2010-07-28 09:33:32 +00:00
|
|
|
_inherit = "account.common.account.report"
|
2010-06-14 08:48:24 +00:00
|
|
|
_name = "account.report.general.ledger"
|
|
|
|
_description = "General Ledger Report"
|
|
|
|
|
|
|
|
_columns = {
|
|
|
|
'landscape': fields.boolean("Landscape Mode"),
|
2010-07-28 10:52:12 +00:00
|
|
|
'initial_balance': fields.boolean("Include initial balances",
|
|
|
|
help='It adds initial balance row on report which display previous sum amount of debit/credit/balance'),
|
|
|
|
'amount_currency': fields.boolean("With Currency", help="It adds the currency column if the currency is different then the company currency"),
|
2010-06-28 07:43:55 +00:00
|
|
|
'sortby': fields.selection([('sort_date', 'Date'), ('sort_journal_partner', 'Journal & Partner')], 'Sort By', required=True),
|
2010-09-17 11:03:57 +00:00
|
|
|
'target_move': fields.selection([('all', 'All Entries'),
|
|
|
|
('posted', 'All Posted Entries')], 'Target Moves', required=True),
|
2010-07-15 23:36:56 +00:00
|
|
|
}
|
2010-06-14 08:48:24 +00:00
|
|
|
_defaults = {
|
2010-07-15 23:36:56 +00:00
|
|
|
'landscape': True,
|
|
|
|
'amount_currency': True,
|
|
|
|
'sortby': 'sort_date',
|
2010-09-14 11:55:02 +00:00
|
|
|
'initial_balance': False,
|
2010-09-17 11:03:57 +00:00
|
|
|
'target_move': 'all',
|
2010-07-15 23:36:56 +00:00
|
|
|
}
|
2010-06-14 08:48:24 +00:00
|
|
|
|
2010-07-22 06:31:51 +00:00
|
|
|
def onchange_fiscalyear(self, cr, uid, ids, fiscalyear=False, context=None):
|
|
|
|
res = {}
|
|
|
|
if not fiscalyear:
|
|
|
|
res['value'] = {'initial_balance': False}
|
|
|
|
return res
|
|
|
|
|
2010-10-01 11:32:41 +00:00
|
|
|
def _print_report(self, cr, uid, ids, data, context=None):
|
2010-07-13 04:42:23 +00:00
|
|
|
if context is None:
|
|
|
|
context = {}
|
2010-10-01 11:32:41 +00:00
|
|
|
data = self.pre_print_report(cr, uid, ids, data, context=context)
|
2010-09-17 11:03:57 +00:00
|
|
|
data['form'].update(self.read(cr, uid, ids, ['landscape', 'initial_balance', 'amount_currency', 'sortby', 'target_move'])[0])
|
2010-07-26 11:45:49 +00:00
|
|
|
if not data['form']['fiscalyear_id']:# GTK client problem onchange does not consider in save record
|
|
|
|
data['form'].update({'initial_balance': False})
|
2010-07-13 04:42:23 +00:00
|
|
|
if data['form']['landscape']:
|
2010-08-02 04:42:43 +00:00
|
|
|
return { 'type': 'ir.actions.report.xml', 'report_name': 'account.general.ledger_landscape', 'datas': data}
|
2010-07-28 09:33:32 +00:00
|
|
|
return { 'type': 'ir.actions.report.xml', 'report_name': 'account.general.ledger', 'datas': data}
|
2010-06-14 08:48:24 +00:00
|
|
|
|
2010-06-14 11:55:48 +00:00
|
|
|
account_report_general_ledger()
|
2010-06-14 08:48:24 +00:00
|
|
|
|
2010-10-01 11:32:41 +00:00
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|