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 " ) ,
2011-05-18 12:59:26 +00:00
' initial_balance ' : fields . boolean ( ' Include Initial Balances ' ,
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. ' ) ,
2010-07-28 10:52:12 +00:00
' amount_currency ' : fields . boolean ( " With Currency " , help = " It adds the currency column if the currency is different then the company currency " ) ,
2011-04-15 10:09:01 +00:00
' sortby ' : fields . selection ( [ ( ' sort_date ' , ' Date ' ) , ( ' sort_journal_partner ' , ' Journal & Partner ' ) ] , ' Sort by ' , 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-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-10-04 09:43:20 +00:00
data [ ' form ' ] . update ( self . read ( cr , uid , ids , [ ' landscape ' , ' initial_balance ' , ' amount_currency ' , ' sortby ' ] ) [ 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: