Merge pull request #446 from akretion/9-fix-reversal-reconciliation

[9.0][Fix] fix reconciliation when reversing an account move
This commit is contained in:
Pedro M. Baeza
2018-03-29 17:23:19 +02:00
committed by GitHub
2 changed files with 8 additions and 3 deletions

View File

@@ -112,5 +112,5 @@ class AccountMove(models.Model):
if moves and post:
moves.post()
if reconcile:
moves.move_reverse_reconcile()
self.move_reverse_reconcile()
return moves

View File

@@ -63,11 +63,16 @@ class TestAccountReversal(TransactionCase):
':SALE_' or ':CUSTOMER_')
for x in move.line_ids.sorted(key=lambda r: r.account_id.id)])
def test_reverse(self):
def test_reverse_posted_reconcile(self):
move = self._create_move()
self.assertEqual(
self._move_str(move), '0.00100.00:SALE_100.000.00:CUSTOMER_')
rev = move.create_reversals()
rev = move.create_reversals(post=True, reconcile=True)
self.assertEqual(len(rev), 1)
self.assertEqual(
self._move_str(rev), '100.000.00:SALE_0.00100.00:CUSTOMER_')
reconciled_line = move.line_ids.filtered(
lambda l: l.account_id.reconcile)
self.assertEqual(
'posted', rev.state)
self.assertTrue(reconciled_line.full_reconcile_id)