Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][FIX] account_move_cutoff: while using full refund wizard #304

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
12 changes: 12 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,15 @@ 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)
)
Loading