[FIX] account: set reconciliation reference for opening entries

When opening entries are generated, the reconcile_id field is updated in SQL
(probably for performances reasons) but the computed and stored field
reconcile_ref is not recomputed by the ORM.
Force the recomputation of the field by calling ORM method _store_set_values.
Fixes #4267, opw 620369
This commit is contained in:
Martin Trigaux 2015-04-07 11:54:53 +02:00
parent 48e059d04f
commit 365eb138b4
1 changed files with 2 additions and 0 deletions

View File

@ -62,6 +62,8 @@ class account_fiscalyear_close(osv.osv_memory):
raise osv.except_osv(_('Warning!'), _('The entries to reconcile should belong to the same company.'))
r_id = self.pool.get('account.move.reconcile').create(cr, uid, {'type': 'auto', 'opening_reconciliation': True})
cr.execute('update account_move_line set reconcile_id = %s where id in %s',(r_id, tuple(ids),))
# reconcile_ref deptends from reconcile_id but was not recomputed
obj_acc_move_line._store_set_values(cr, uid, ids, ['reconcile_ref'], context=context)
obj_acc_move_line.invalidate_cache(cr, uid, ['reconcile_id'], ids, context=context)
return r_id