[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) <agr@odoo.com>
Signed-off-by: Altaf Shaik (alsh) <alsh@odoo.com>
This commit is contained in:
alsh-odoo
2023-12-21 04:56:58 +00:00
parent 763cd36f65
commit 9dae491432
+2 -2
View File
@@ -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')