Merel Geens (mege) 4e9453b6f8 [IMP] account: don't generate unaddressable root account
In the ORM computation for account_account's root_id field, the root_id
will be set to NULL in the db if the code doesn't evaluate to True in
Python. This means that if the code is the empty string '', the
corresponding root_id will be False and the account will not be shown
under any root subsections in the chart of accounts, only the All
section (which makes sense). In normal use empty codes can't happen
because the UI doesn't allow it. The database does, which means it can
occur in certain corner cases.

The account root view computation is inconsistent with the ORM
computation and it will generate an empty account root with id 0 for an
account with an empty code ''. This account root can't be referenced by
an account because if the root_id is False, there is no reference and if
the root_id is 0, you'll get a traceback when loading the chart of
accounts. A read_group call will be done that filters on non-NULL root
id's (like 0) in account_account, but the ORM will then interpret that 0
value as False. This means the read_group call ends up returning a
boolean instead of a tuple for that line, which causes a traceback when
the tuple is expected.

So to summarize, this change prevents an account root that can't be
referenced from being generated in the obscure corner case where the
code is ''. It aligns the logic of the account root view computation
with that of the ORM computation.

I didn't keep the check on NULL from the original query, because the
code is a required field.

closes odoo/odoo#114279

Signed-off-by: William André (wan) <wan@odoo.com>
2023-08-30 05:52:58 +00:00
2023-08-29 07:48:10 +00:00
…
…
…
…

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%