def action_draft(self, cr, uid, ids, *args):
mode = 'draft'
-- for id in ids:
- cr.execute('update account_journal_period set state=%s where period_id=%s', (mode, id))
- cr.execute('update account_period set state=%s where id=%s', (mode, id))
- period = self.browse(cr, uid, id)
++ for period in self.browse(cr, uid, ids):
+ if period.fiscalyear_id.state == 'done':
+ raise osv.except_osv(_('Warning !'), _('You can not re-open a period which belongs to closed fiscal year'))
- cr.execute('update account_journal_period set state=%s where period_id=%s', (mode, id))
- cr.execute('update account_period set state=%s where id=%s', (mode, id))
++ cr.execute('update account_journal_period set state=%s where period_id in %s', (mode, tuple(ids)))
++ cr.execute('update account_period set state=%s where id in %s', (mode, tuple(ids)))
return True
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):