solved error of no period_ids and misc. changes in wizard_fiscalyear_close.py

bzr revid: jvo@tinyerp.com-20080728134904-jya4666cek62lau2
This commit is contained in:
Jay Vora 2008-07-28 19:19:04 +05:30
parent 931e97624b
commit e24b7ccf12
1 changed files with 7 additions and 3 deletions

View File

@ -58,17 +58,21 @@ def _data_load(self, cr, uid, data, context):
def _data_save(self, cr, uid, data, context):
if not data['form']['sure']:
raise wizard.except_wizard(_('UserError'), _('Closing of fiscal year canceled, please check the box !'))
raise wizard.except_wizard(_('UserError'), _('Closing of fiscal year cancelled, please check the box !'))
pool = pooler.get_pool(cr.dbname)
fy_id = data['form']['fy_id']
if data['form']['report_new']:
period = pool.get('account.fiscalyear').browse(cr, uid, data['form']['fy2_id']).period_ids[0]
periods_fy2 = pool.get('account.fiscalyear').browse(cr, uid, data['form']['fy2_id']).period_ids
if not periods_fy2:
raise wizard.except_wizard(_('UserError'),
_('There are no periods defined on New Fiscal Year.'))
period=periods_fy2[0]
new_fyear = pool.get('account.fiscalyear').browse(cr, uid, data['form']['fy2_id'])
start_jp = new_fyear.start_journal_period_id
if not start_jp:
raise wizard.except_wizard(_('UserError'),
_('The new fiscal year should have a journal for new entries define on it'))
_('The new fiscal year should have a journal for new entries defined on it.'))
new_journal = start_jp.journal_id