From 9dae4914322e24102b670efebbdf5fae110efbed Mon Sep 17 00:00:00 2001 From: alsh-odoo Date: Wed, 20 Dec 2023 10:19:47 +0530 Subject: [PATCH] [FIX] account: fix traceback when from or to value is false This traceback arises when the user removes the from or to values. To reproduce this traceback: 1) Install 'account_accountant' and make sure the debugger mode on 2) Open 'Accounting/Configuration/Account Groups' 3) Create a new record 4) Give the 'from' and 'to' values and save the record. 5) Now remove the 'From' value and try to save it Error:- "TypeError: '>' not supported between instances of 'str' and 'bool'" When removing the 'to' value 'code_prefix_end' will be False. It leads to the above traceback from here. https://github.com/odoo/odoo/blob/230b680bf92583c9f5e4a3739be1d8602df44331/addons/account/models/account_account.py#L838-L842 sentry-4715927815 closes odoo/odoo#147041 X-original-commit: 0d20e3f14c749c3bf6df4349ce1c2c256f771c7e Signed-off-by: Andrea Grazioso (agr) Signed-off-by: Altaf Shaik (alsh) --- addons/account/models/account_account.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_account.py b/addons/account/models/account_account.py index 53005112e98..cc875abd1dd 100644 --- a/addons/account/models/account_account.py +++ b/addons/account/models/account_account.py @@ -832,13 +832,13 @@ class AccountGroup(models.Model): @api.depends('code_prefix_start') def _compute_code_prefix_end(self): for group in self: - if not group.code_prefix_end or group.code_prefix_end < group.code_prefix_start: + if not group.code_prefix_end or (group.code_prefix_start and group.code_prefix_end < group.code_prefix_start): group.code_prefix_end = group.code_prefix_start @api.depends('code_prefix_end') def _compute_code_prefix_start(self): for group in self: - if not group.code_prefix_start or group.code_prefix_start > group.code_prefix_end: + if not group.code_prefix_start or (group.code_prefix_end and group.code_prefix_start > group.code_prefix_end): group.code_prefix_start = group.code_prefix_end @api.depends('code_prefix_start', 'code_prefix_end')