Step to reproduce :
- run a V15 instance
- add a reference to 'OCA/geospatial' repo that doesn't contain any odoo module.
As a result, Odoo will exit with the following error:
odoo-bin: error: option --addons-path: the path '/odoo_env/src/OCA/geospatial' is not a valid addons directory
To avoid such problem, and avoid to have to remove empty repository
(that could become non empty in the future, and contains some migrations scripts),
- we reimplement a version of the odoo function _is_addons_path (odoo/odoo/tools/config.py)
- we add an info log :
Skipping addons path '.../src/env_15.0/src/OCA/geospatial' because it doesn't contain any odoo module.
Previous syntax does not replace correctly the markers in the string.
Using an f-string fix this.
Before:
2024-02-06 10:47:02.303 | WARNING | odoo_openupgrade_wizard.tools.tools_odoo_module:get_odoo_apps_url:359 - Error when trying to get %s: %s
After:
2024-02-07 10:51:11.964 | WARNING | odoo_openupgrade_wizard.tools.tools_odoo_module:get_odoo_apps_url:356 - Error when trying to get https://apps.odoo.com/apps/modules/12.0/partner_contact_address/: Exceeded 30 redirects.
The linting check can be done on any docker image with the latest python
version.
This updates de pre-commit checks and fix file linting to conform to new
standards.
root user should not be used to create container and oow should not be
run as root.
But when running oow in a docker, then the default user of this docker
can be root.
This fix allow to link the odoo user in the odoo environment docker to
match a root user of the host docker.
Removing a container can take some time to be performed. Listing
containers when a container is currently being removed may cause errors.
Because listing container and filtering them by name requires to fetch
data from the container that is currently being removed.
Depending of the test environment, the url of the odoo container may
change.
Using pytest in a local shell, Odoo will be available at 0.0.0.0
address.
Using pytest in a docker-in-docker environment, the url for the Odoo
container will be exposed on a different address depending on the
configuration of the docker-in-docker environment.
The mock check whether the user has configured a différent URL for the
Odoo RPC calls, and set it accordingly using mock feature.
In the gitlab-ci, the ODOO_RPC_URL should be used to set the correct
address for the RPC calls.
In a proper file each line end with a newline character, even the last
one.
Wrong file:
Using `write()` function does not add a newline character at the end of
the write. So writing a string in a file with `write()` leads to a file
like this:
```
line1\n
line2\n
lastline
```
Good file:
Using the `print()` command automatically ends the string with a newline
character. So that we ends with a proper file:
```
line1\n
line2\n
lastline\n
```
Also the with statement automatically closes the file at the end of the
block.