Skip to content

Commit

Permalink
[FIX] account_move_cutoff: while using full refund wizard
Browse files Browse the repository at this point in the history
action_post is not called better to overload _post on account.move model
  • Loading branch information
petrus-v committed Sep 22, 2024
1 parent 22b5101 commit 78daab1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions account_move_cutoff/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def button_draft(self):
self.cutoff_entry_ids.with_context(force_delete=True).unlink()
return res

def action_post(self):
result = super().action_post()
def _post(self, *args, **kwargs):
result = super()._post(*args, **kwargs)
for move, lines in self._get_deferrable_lines():
move._create_cutoff_entries(lines)

Expand Down
13 changes: 13 additions & 0 deletions account_move_cutoff/tests/test_account_invoice_cutoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,3 +538,16 @@ def test_account_invoice_cutoff_monthly_factor_prorata(self):
255.0,
2,
)

def test_reverse_moves_reverse_deffered(self):

with freeze_time("2023-01-15"):
self.invoice.action_post()
self.assertTrue(len(self.invoice.cutoff_entry_ids)>0)
refund = self.invoice._reverse_moves(cancel=True)

self.assertEqual(refund.state, "posted")
self.assertEqual(
len(self.invoice.cutoff_entry_ids),
len(refund.cutoff_entry_ids)
)

0 comments on commit 78daab1

Please sign in to comment.