~openerp-community/openobject-addons/taktik

« back to all changes in this revision

Viewing changes to account/wizard/wizard_general_ledger_report.py

  • Committer: Fabien Lydoire
  • Date: 2010-06-18 09:43:14 UTC
  • Revision ID: fl@taktik.be-20100618094314-rsei1ysqf6uwz6nf
added account reports in xls

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
 
49
49
    <field name="soldeinit" invisible="1"/>
50
50
  
51
 
    <field name="landscape"/>
 
51
    <field name="mode"/>
52
52
    <field name="amount_currency"/>
53
53
    <newline/>
54
54
    <separator string="Filters" colspan="4"/>
85
85
    'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'},
86
86
    'sortbydate':{'string':"Sort by:",'type':'selection','selection':[('sort_date','Date'),('sort_mvt','Movement')]},
87
87
    'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With movements'),('bal_all','All'),('bal_solde','With balance is not equal to 0')]},
88
 
    'landscape':{'string':"Landscape Mode",'type':'boolean'},
 
88
    'mode': {'string': 'Mode',
 
89
             'type': 'selection',
 
90
             'selection': [
 
91
                ('pdf_a4_portrait', 'PDF Portrait'),
 
92
                ('pdf_a4_landscape', 'PDF Landscape'),
 
93
                ('spreadsheet_xls', 'Excel Spreadsheet')
 
94
            ],
 
95
            'default': lambda *a: 'pdf_a4_landscape',
 
96
    },
89
97
    'soldeinit':{'string':"Include initial balances",'type':'boolean'},
90
98
    'amount_currency':{'string':"With Currency",'type':'boolean'},
91
99
    'date_from': {'string':"           Start date",'type':'date','required':True ,'default': lambda *a: time.strftime('%Y-01-01')},
98
106
        return 'account_selection'
99
107
 
100
108
def _check(self, cr, uid, data, context):
101
 
    if data['form']['landscape']==True:
 
109
    mode = data['form']['mode']
 
110
    if mode == 'pdf_a4_landscape':
102
111
        return 'report_landscape'
 
112
    elif mode == 'spreadsheet_xls':
 
113
        return 'report_xls'
103
114
    else:
104
115
        return 'report'
105
116
 
144
155
        #data['form']['periods'] =periods_obj.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
145
156
        data['form']['sortbydate'] = 'sort_date'
146
157
        data['form']['display_account']='bal_all'
147
 
        data['form']['landscape']=True
 
158
        data['form']['mode']='pdf_a4_landscape'
148
159
        data['form']['fiscalyear'] = False
149
160
        data['form']['amount_currency'] = True
150
161
        data['form']['context'] = context
174
185
        'report': {
175
186
            'actions': [_check_state],
176
187
            'result': {'type':'print', 'report':'account.general.ledger', 'state':'end'}
177
 
        }
 
188
        },
 
189
        'report_xls': {
 
190
            'actions': [_check_state],
 
191
            'result': {'type':'print', 'report':'account.general.ledger.xls', 'state': 'end'}
 
192
        },
 
193
 
178
194
    }
179
195
wizard_report('account.general.ledger.report')
180
196
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: