[FIX] account: Con not open account chart from Wizard If we passing fiscal year argument

bzr revid: ara@tinyerp.com-20110316132833-momnoero73a9q7g4
This commit is contained in:
ARA (OpenERP) 2011-03-16 18:58:33 +05:30
parent cac45480ce
commit 46003bb7e1
1 changed files with 6 additions and 6 deletions

View File

@ -30,12 +30,12 @@ class account_chart(osv.osv_memory):
_columns = {
'fiscalyear': fields.many2one('account.fiscalyear', \
'Fiscal year', \
help = 'Keep empty for all open fiscal years'),
help='Keep empty for all open fiscal years'),
'period_from': fields.many2one('account.period', 'Start period'),
'period_to': fields.many2one('account.period', 'End period'),
'target_move': fields.selection([('posted', 'All Posted Entries'),
('all', 'All Entries'),
], 'Target Moves', required = True),
], 'Target Moves', required=True),
}
def onchange_fiscalyear(self, cr, uid, ids, fiscalyear_id=False, context=None):
@ -83,16 +83,16 @@ class account_chart(osv.osv_memory):
result = mod_obj.get_object_reference(cr, uid, 'account', 'action_account_tree')
id = result and result[1] or False
result = act_obj.read(cr, uid, [id], context=context)[0]
fiscalyear = data.get('fiscalyear', False) and data['fiscalyear'][0] or False
fiscalyear_id = data.get('fiscalyear', False) and data['fiscalyear'][0] or False
result['periods'] = []
if data['period_from'] and data['period_to']:
period_from = data.get('period_from', False) and data['period_from'][0] or False
period_to = data.get('period_to', False) and data['period_to'][0] or False
result['periods'] = period_obj.build_ctx_periods(cr, uid, period_from, period_to)
result['context'] = str({'fiscalyear': fiscalyear, 'periods': result['periods'], \
result['context'] = str({'fiscalyear': fiscalyear_id, 'periods': result['periods'], \
'state': data['target_move']})
if data['fiscalyear']:
result['name'] += ':' + fy_obj.read(cr, uid, [fiscalyear], context=context)[0]['code']
if fiscalyear_id:
result['name'] += ':' + fy_obj.read(cr, uid, [fiscalyear_id], context=context)[0]['code']
return result
_defaults = {