35
35
if not data_fyear.end_journal_period_id:
36
36
raise osv.except_osv(_('Error'), _('No journal for ending writing has been defined for the fiscal year'))
37
37
period_journal = data_fyear.end_journal_period_id
38
ids_move = self.pool.get('account.move').search(cr,uid,[('journal_id','=',period_journal.journal_id.id),('period_id','=',period_journal.period_id.id)])
38
ids_move = self.pool.get('account.move').search(cr, uid, [('journal_id','=',period_journal.journal_id.id),('period_id','=',period_journal.period_id.id)])
40
cr.execute('delete from account_move where id =ANY(%s)',(ids_move,))
41
#cr.execute('UPDATE account_journal_period ' \
43
# 'WHERE period_id IN (SELECT id FROM account_period WHERE fiscalyear_id = %s)',
44
# ('draft',data_fyear))
45
#cr.execute('UPDATE account_period SET state = %s ' \
46
# 'WHERE fiscalyear_id = %s', ('draft',data_fyear))
47
#cr.execute('UPDATE account_fiscalyear ' \
48
# 'SET state = %s, end_journal_period_id = null '\
49
# 'WHERE id = %s', ('draft',data_fyear))
40
cr.execute('delete from account_move where id IN %s', (tuple(ids_move),))
52
43
account_open_closed_fiscalyear()