From e33bee1f05f858379de2acced9f99a4db45af15b Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 27 Feb 2019 10:47:08 +0100 Subject: [PATCH] account_usability: improve create group script --- account_usability/account.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/account_usability/account.py b/account_usability/account.py index f4d5a02..824dc82 100644 --- a/account_usability/account.py +++ b/account_usability/account.py @@ -297,7 +297,13 @@ class AccountAccount(models.Model): accounts = self.search([]) struct = {'childs': {}} for account in accounts: - assert len(account.code) > level + if len(account.code) <= level: + logger.warning( + "Account '%s' in company '%s' is smaller than " + "level (%d).", + account.display_name, account.company_id.display_name, + level) + continue n = 1 parent = struct gparent = False