[FIX] account_journal_general_sequence: bottleneck at install

On databases with big amounts of account moves, installation would freeze Odoo for some minutes.

We skip now entry number computation at install, to avoid such cases.

@moduon MT-676
This commit is contained in:
Jairo Llopis
2022-06-03 12:39:52 +01:00
parent c545b674e8
commit 2ebd95053f
6 changed files with 67 additions and 14 deletions

View File

@@ -55,3 +55,19 @@ class RenumberCase(TestAccountReconciliationCommon):
wiz = wiz_f.save()
wiz.action_renumber()
self.assertEqual(opening_invoice.entry_number, "2022/0000000000")
def test_install_no_entry_number(self):
"""No entry numbers assigned on module installation."""
# Imitate installation environment
self.env = self.env(
context=dict(self.env.context, module="account_journal_general_sequence")
)
self.env["ir.module.module"].search(
[("name", "=", "account_journal_general_sequence")]
).state = "to install"
# Do some action that would make the move get an entry number
invoice = self._create_invoice()
self.assertFalse(invoice.entry_number)
invoice.action_post()
# Ensure there's no entry number
self.assertFalse(invoice.entry_number)