for form in self.read(cr, uid, ids, context=context):
if form['sure']:
for id in context['active_ids']:
for form in self.read(cr, uid, ids, context=context):
if form['sure']:
for id in context['active_ids']:
- account_move_ids = account_move_obj.search(cr, uid, [('period_id', '=', id)], context=context)
+ account_move_ids = account_move_obj.search(cr, uid, [('period_id', '=', id), ('state', '=', "draft")], context=context)
if account_move_ids:
raise osv.except_osv(_('Invalid action !'), _('In order to close a period, you must first post related journal items.'))
if account_move_ids:
raise osv.except_osv(_('Invalid action !'), _('In order to close a period, you must first post related journal items.'))