~openerp-community/openobject-addons/taktik

« back to all changes in this revision

Viewing changes to account/wizard/wizard_account_balance_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:
33
33
    <field name="fiscalyear"/>
34
34
    <label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
35
35
    <newline/>
 
36
    <field name="mode"/>
 
37
    <newline/>
36
38
    <separator string="Filters" colspan="4"/>
37
39
    <field name="state" required="True"/>
38
40
    <newline/>
67
69
    'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With movements'),('bal_all','All'),('bal_solde','With balance is not equal to 0')]},
68
70
    'date_from': {'string':"Start date",'type':'date','required':True ,'default': lambda *a: time.strftime('%Y-01-01')},
69
71
    'date_to': {'string':"End date",'type':'date','required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
 
72
    'mode': {
 
73
        'string': 'Mode',
 
74
        'type': 'selection',
 
75
        'selection': [
 
76
            ('pdf_a4_portrait', 'PDF Portrait'),
 
77
            ('spreadsheet_xls', 'Excel Spreasheet'),
 
78
        ],
 
79
        'default': 'pdf_a4_portrait',
 
80
    }
70
81
}
71
82
 
72
83
account_form = '''<?xml version="1.0"?>
91
102
        data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
92
103
#        data['form']['periods'] = periods_obj.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
93
104
#        data['form']['fiscalyear'] = False
 
105
        data['form']['mode'] = 'pdf_a4_portrait'
94
106
        data['form']['display_account'] = 'bal_all'
95
107
        data['form']['context'] = context
96
108
        return data['form']
97
109
 
 
110
    def _check(self, cr, uid, data, context):
 
111
        mode = data.get('form',{}).get('mode','')
 
112
        if mode == 'spreadsheet_xls':
 
113
            return 'report_xls'
 
114
        else:
 
115
            return 'report'
 
116
 
98
117
    def _check_state(self, cr, uid, data, context):
99
118
 
100
119
        if data['form']['state'] == 'bydate':
135
154
        },
136
155
        'checktype': {
137
156
            'actions': [_get_defaults],
138
 
            'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
 
157
            'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel','gtk-cancel'),('checkreport','Print','gtk-print')]}
 
158
        },
 
159
        'checkreport': {
 
160
            'actions': [],
 
161
            'result': {'type': 'choice', 'next_state': _check},
139
162
        },
140
163
        'report': {
141
164
            'actions': [_check_state],
142
165
            'result': {'type':'print', 'report':'account.account.balance', 'state':'end'}
143
 
        }
 
166
        },
 
167
        'report_xls': {
 
168
            'actions': [_check_state],
 
169
            'result': {'type': 'print', 'report': 'account.account.balance.xls', 'state': 'end'},
 
170
        },
144
171
    }
145
172
wizard_report('account.account.balance.report')
146
173
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: