[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:
parent
1a1d816c7b
commit
67945e427a
@ -44,3 +44,14 @@ class RenumberCase(TestAccountReconciliationCommon):
|
|||||||
wiz = wiz_f.save()
|
wiz = wiz_f.save()
|
||||||
wiz.action_renumber()
|
wiz.action_renumber()
|
||||||
self.assertGreater(new_invoice.entry_number, old_invoice.entry_number)
|
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")
|
||||||
|
@ -74,8 +74,8 @@ class AccountMoveRenumberWizard(models.TransientModel):
|
|||||||
)
|
)
|
||||||
future_ranges.unlink()
|
future_ranges.unlink()
|
||||||
current_range = self.sequence_id._get_current_sequence(self.starting_date)
|
current_range = self.sequence_id._get_current_sequence(self.starting_date)
|
||||||
current_range.number_next_actual = self.starting_number
|
current_range.number_next = self.starting_number
|
||||||
self.sequence_id.number_next_actual = self.starting_number
|
self.sequence_id.number_next = self.starting_number
|
||||||
# Renumber the moves
|
# Renumber the moves
|
||||||
moves.entry_number = False
|
moves.entry_number = False
|
||||||
moves.flush(["entry_number"])
|
moves.flush(["entry_number"])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user