1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-2010 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 ##############################################################################
22 from openerp.osv import fields, osv
25 class account_report_general_ledger(osv.osv_memory):
26 _inherit = "account.common.account.report"
27 _name = "account.report.general.ledger"
28 _description = "General Ledger Report"
31 'landscape': fields.boolean("Landscape Mode"),
32 'initial_balance': fields.boolean('Include Initial Balances',
33 help='If you selected to filter by date or period, this field allow you to add a row to display the amount of debit/credit/balance that precedes the filter you\'ve set.'),
34 'amount_currency': fields.boolean("With Currency", help="It adds the currency column on report if the currency differs from the company currency."),
35 'sortby': fields.selection([('sort_date', 'Date'), ('sort_journal_partner', 'Journal & Partner')], 'Sort by', required=True),
36 'journal_ids': fields.many2many('account.journal', 'account_report_general_ledger_journal_rel', 'account_id', 'journal_id', 'Journals', required=True),
40 'amount_currency': True,
41 'sortby': 'sort_date',
42 'initial_balance': False,
45 def onchange_fiscalyear(self, cr, uid, ids, fiscalyear=False, context=None):
48 res['value'] = {'initial_balance': False}
51 def _print_report(self, cr, uid, ids, data, context=None):
54 data = self.pre_print_report(cr, uid, ids, data, context=context)
55 data['form'].update(self.read(cr, uid, ids, ['landscape', 'initial_balance', 'amount_currency', 'sortby'])[0])
56 if not data['form']['fiscalyear_id']:# GTK client problem onchange does not consider in save record
57 data['form'].update({'initial_balance': False})
59 if data['form']['landscape'] is False:
60 data['form'].pop('landscape')
62 return self.pool['report'].get_action(cr, uid, [], 'account.report_generalledger', data=data, context=context)
64 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: