[FIX] account.move.line: no move revalidation for trivial changes

Many trivial changes to journal items, such as the
"blocked" flag for litigation (follow-up), do not affect
the balance of the whole entry. These should not cause
the account.move to be (re)validated.

For example it should be possible to change trivial
fields even on journal entries recorded in a closed
fiscal period.
This commit is contained in:
Olivier Dony 2015-02-09 20:11:07 +01:00
parent 0892a088fc
commit f55a6046a8
1 changed files with 7 additions and 4 deletions

View File

@ -1172,9 +1172,11 @@ class account_move_line(osv.osv):
raise osv.except_osv(_('Unable to change tax!'), _('You cannot change the tax, you should remove and recreate lines.'))
if ('account_id' in vals) and not account_obj.read(cr, uid, vals['account_id'], ['active'])['active']:
raise osv.except_osv(_('Bad Account!'), _('You cannot use an inactive account.'))
if update_check:
if ('account_id' in vals) or ('journal_id' in vals) or ('period_id' in vals) or ('move_id' in vals) or ('debit' in vals) or ('credit' in vals) or ('date' in vals):
self._update_check(cr, uid, ids, context)
affects_move = any(f in vals for f in ('account_id', 'journal_id', 'period_id', 'move_id', 'debit', 'credit', 'date'))
if update_check and affects_move:
self._update_check(cr, uid, ids, context)
todo_date = None
if vals.get('date', False):
@ -1198,7 +1200,8 @@ class account_move_line(osv.osv):
if journal.centralisation:
self._check_moves(cr, uid, context=ctx)
result = super(account_move_line, self).write(cr, uid, ids, vals, context)
if check and not context.get('novalidate'):
if affects_move and check and not context.get('novalidate'):
done = []
for line in self.browse(cr, uid, ids):
if line.move_id.id not in done: