Skip to content

[19.0] odoo cloc is not working with -d odoo #679

@ap-wtioit

Description

@ap-wtioit

Describe the bug

docker compose -f devel.yaml run --rm odoo odoo cloc -c auto/addons.conf -d odoo is only reporting empty results:

[+] Creating N/N
 ✔ Container doodba-next-wdb-1         Running                                                                                                                                                                               0.0s 
 ✔ Container doodba-next-db-1          Running                                                                                                                                                                               0.0s 
 ✔ Container doodba-next-smtp-1        Running                                                                                                                                                                               0.0s 
WARN[0000] mount of type `volume` should not define `bind` option 
doodba INFO: Waiting until postgres is listening at db...
doodba INFO: Linking all addons from /opt/odoo/custom/src/addons.yaml in /opt/odoo/auto/addons
doodba INFO: Activating GeoIP/GeoLite2 updates
doodba INFO: This product includes GeoLite2 data created by MaxMind, available from https://www.maxmind.com
doodba INFO: Generating /opt/odoo/auto/odoo.conf file. Overriding any existing...
doodba INFO: Merging found configuration files in /opt/odoo/auto/odoo.conf
doodba INFO: Executing odoo cloc -c auto/odoo.conf -d devel
2025-10-07 14:14:46,016 1 WARNING ? odoo.tools.config: option smtp_user reads 'false' in the config file at /opt/odoo/auto/odoo.conf but isn't a boolean option, skip 
2025-10-07 14:14:46,016 1 WARNING ? odoo.tools.config: option smtp_password reads 'false' in the config file at /opt/odoo/auto/odoo.conf but isn't a boolean option, skip 
2025-10-07 14:14:46,016 1 WARNING ? odoo.tools.config: unknown option 'cache_timeout' in the config file at /opt/odoo/auto/odoo.conf, option stored as-is, without parsing 
2025-10-07 14:14:46,016 1 INFO ? odoo.tools.config: adding missing 'base' to --load/server_wide_modules 
2025-10-07 14:14:46,016 1 WARNING ? odoo.tools.config: option smtp_user reads 'false' in the config file at /opt/odoo/auto/odoo.conf but isn't a boolean option, skip 
2025-10-07 14:14:46,016 1 WARNING ? odoo.tools.config: option smtp_password reads 'false' in the config file at /opt/odoo/auto/odoo.conf but isn't a boolean option, skip 
2025-10-07 14:14:46,016 1 WARNING ? odoo.tools.config: unknown option 'cache_timeout' in the config file at /opt/odoo/auto/odoo.conf, option stored as-is, without parsing 
2025-10-07 14:14:46,016 1 INFO ? odoo.tools.config: adding missing 'base' to --load/server_wide_modules 
2025-10-07 14:14:46,016 1 WARNING ? odoo.tools.config: missing --http-interface/http_interface, using 0.0.0.0 by default, will change to 127.0.0.1 in 20.0 
2025-10-07 14:14:46,031 1 INFO ? odoo.modules.loading: loading 1 modules... 
2025-10-07 14:14:46,351 1 INFO ? odoo.modules.loading: 1 modules loaded in 0.32s, 0 queries (+0 extra) 
2025-10-07 14:14:46,357 1 INFO ? odoo.modules.loading: loading 25 modules... 
2025-10-07 14:14:46,660 1 INFO ? odoo.modules.loading: 25 modules loaded in 0.30s, 0 queries (+0 extra) 
2025-10-07 14:14:46,691 1 INFO ? odoo.modules.loading: Modules loaded. 
2025-10-07 14:14:46,728 1 INFO ? odoo.registry: Registry loaded in 0.712s 
Odoo cloc                                                                 Line   Other    Code
----------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------
                                                                             0       0       0

To Reproduce

Affected versions: 19.0

Steps to reproduce the behavior:

  1. docker compose -f devel.yaml run --rm odoo odoo -i my,list,of,modules --stop-after-init
  2. docker compose -f devel.yaml run --rm odoo odoo cloc -c auto/addons.conf -d odoo

Expected behavior A clear and concise description of what you expected to happen.

The cloc report should not be empty (redacted example from 17.0):

...
2025-10-07 08:30:50,209 29 INFO ? odoo.modules.loading: loading 32 modules... 
2025-10-07 08:30:50,544 29 INFO ? odoo.modules.loading: 32 modules loaded in 0.33s, 0 queries (+0 extra) 
2025-10-07 08:30:50,586 29 INFO ? odoo.modules.loading: Modules loaded. 
2025-10-07 08:30:50,588 29 INFO ? odoo.modules.registry: Registry loaded in 0.598s 
Odoo cloc                                                   Line   Other    Code
--------------------------------------------------------------------------------
auth_oidc                                                    331      93     238
redacted_1                                          16       2      14
redacted_2                                                     472     153     319
redacted_3                                            334      81     253
redacted_4                                       3557     762    2795
--------------------------------------------------------------------------------
                                                            4710    1091    3619

Additional context Add any other context about the problem here. (e.g. OS, Docker
version, ...)

Because of odoo/odoo@8e496b3#diff-7a55280b82bbf3b5be0539d106a40feb8a359a18d048ca45868acbeb7c03b9ceL164-L171 the excluded paths are no longer matched with os.path.realpath the exclude_path is now {'/opt/odoo/auto/addons', '/opt/odoo/custom/src/odoo/odoo/addons'} in doodba and cloc excludes all addons if used in database mode

Path mode for a single addon using docker compose run --rm odoo odoo cloc -p /opt/odoo/auto/addons/auth_oidc is working:

[+] Creating N/N
 ✔ Container doodba-next-smtp-1        Running                                                                                                                                                                               0.0s 
 ✔ Container doodba-next-db-1          Running                                                                                                                                                                               0.0s 
 ✔ Container doodba-next-wdb-1         Running                                                                                                                                                                               0.0s 
WARN[0000] mount of type `volume` should not define `bind` option 
doodba INFO: Waiting until postgres is listening at db...
doodba INFO: Linking all addons from /opt/odoo/custom/src/addons.yaml in /opt/odoo/auto/addons
doodba INFO: Activating GeoIP/GeoLite2 updates
doodba INFO: This product includes GeoLite2 data created by MaxMind, available from https://www.maxmind.com
doodba INFO: Generating /opt/odoo/auto/odoo.conf file. Overriding any existing...
doodba INFO: Merging found configuration files in /opt/odoo/auto/odoo.conf
doodba INFO: Executing odoo cloc -p /opt/odoo/auto/addons/auth_oidc
Odoo cloc                                                                 Line   Other    Code
----------------------------------------------------------------------------------------------
auth_oidc                                                                  315      88     227
----------------------------------------------------------------------------------------------
                                                                           315      88     227

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions