2
0

[FIX] account_journal_general_sequence: support renumber starting from zero

This is a special case when working with `ir.sequence`.

@moduon MT-676
This commit is contained in:
Jairo Llopis 2022-05-31 09:38:32 +01:00
parent 1a1d816c7b
commit 67945e427a
No known key found for this signature in database
GPG Key ID: E47E3BE44B940490
2 changed files with 13 additions and 2 deletions

View File

@ -44,3 +44,14 @@ class RenumberCase(TestAccountReconciliationCommon):
wiz = wiz_f.save()
wiz.action_renumber()
self.assertGreater(new_invoice.entry_number, old_invoice.entry_number)
# Add opening move
opening_invoice = self._create_invoice(
date_invoice="2022-01-01", auto_validate=True
)
self.assertGreater(opening_invoice.entry_number, new_invoice.entry_number)
# Renumber again, starting from zero
wiz_f = Form(self.env["account.move.renumber.wizard"])
wiz_f.starting_number = 0
wiz = wiz_f.save()
wiz.action_renumber()
self.assertEqual(opening_invoice.entry_number, "2022/0000000000")

View File

@ -74,8 +74,8 @@ class AccountMoveRenumberWizard(models.TransientModel):
)
future_ranges.unlink()
current_range = self.sequence_id._get_current_sequence(self.starting_date)
current_range.number_next_actual = self.starting_number
self.sequence_id.number_next_actual = self.starting_number
current_range.number_next = self.starting_number
self.sequence_id.number_next = self.starting_number
# Renumber the moves
moves.entry_number = False
moves.flush(["entry_number"])