Skip to content
Permalink
Browse files

[FIX] Use norecompute in order to speed up the reverse move creatrion…

… of the move lines unreconciled
  • Loading branch information...
hugho-ad committed Feb 14, 2019
1 parent ee7de26 commit 21907e1b13021d7de2aeca83636abaa21dd1f179
Showing with 12 additions and 10 deletions.
  1. +12 −10 addons/account/models/account_move.py
@@ -232,16 +232,18 @@ def assert_balanced(self):
@api.multi
def _reverse_move(self, date=None, journal_id=None):
self.ensure_one()
reversed_move = self.copy(default={
'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.with_context(check_move_validity=False):
acm_line.write({
'debit': acm_line.credit,
'credit': acm_line.debit,
'amount_currency': -acm_line.amount_currency
})
with self.env.norecompute():
reversed_move = self.copy(default={
'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.with_context(check_move_validity=False):
acm_line.write({
'debit': acm_line.credit,
'credit': acm_line.debit,
'amount_currency': -acm_line.amount_currency
})
self.recompute()
return reversed_move

@api.multi

0 comments on commit 21907e1

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.