From 7da8e1466928f7e43240ca42cad29f0f3e2fba7d Mon Sep 17 00:00:00 2001 From: Julien Castiaux Date: Tue, 11 Aug 2020 09:58:30 +0000 Subject: [PATCH] [FIX] config: empty argument --foo= to disable In the odoorc file, set a `logfile` path, but disable it via the command line with `--logfile=`. The logs are output to the logfile configured in the config file instead of stdout. Parsing `--logile=` yield an empty string which was interpreted as argument not set and skipped. Closes #3852 closes odoo/odoo#60992 X-original-commit: bae0d99b8d654283be4d265e3b40a83247a2299c Signed-off-by: Martin Trigaux (mat) Signed-off-by: Julien Castiaux --- odoo/tools/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/tools/config.py b/odoo/tools/config.py index e703ee33ad9..f6e186f15ab 100644 --- a/odoo/tools/config.py +++ b/odoo/tools/config.py @@ -439,7 +439,7 @@ class configmanager(object): for arg in keys: # Copy the command-line argument (except the special case for log_handler, due to # action=append requiring a real default, so we cannot use the my_default workaround) - if getattr(opt, arg): + if getattr(opt, arg, None) is not None: self.options[arg] = getattr(opt, arg) # ... or keep, but cast, the config file value. elif isinstance(self.options[arg], str) and self.casts[arg].type in optparse.Option.TYPE_CHECKER: