[FIX] account: avoid with_context in loop

Because it uses a different cache for each iteration, which slows down
the process.
This commit is contained in:
Nicolas Martinelli
2017-05-18 17:10:42 +02:00
parent 9553355660
commit 46bb7921e7
+2 -2
View File
@@ -228,8 +228,8 @@ class AccountMove(models.Model):
'date': date,
'journal_id': journal_id.id if journal_id else self.journal_id.id,
'ref': _('reversal of: ') + self.name})
for acm_line in reversed_move.line_ids:
acm_line.with_context(check_move_validity=False).write({
for acm_line in reversed_move.line_ids.with_context(check_move_validity=False):
acm_line.write({
'debit': acm_line.credit,
'credit': acm_line.debit,
'amount_currency': -acm_line.amount_currency