[FIX] base: avoid warning when computing desc of to_buy modules

post upgrade tests will trigger 'module not found' warning when testing modules views
because of 'fake' modules without real file path.

closes odoo/odoo#56335

Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
This commit is contained in:
Xavier-Do
2020-08-21 16:07:00 +00:00
parent 1495065041
commit 4da3f9cf1c
3 changed files with 12 additions and 7 deletions
+7 -5
View File
@@ -191,12 +191,14 @@ def get_resource_path(module, *args):
TODO make it available inside on osv object (self.get_resource_path)
"""
mod_path = get_module_path(module)
if not mod_path: return False
if not mod_path:
return False
return check_resource_path(mod_path, *args)
def check_resource_path(mod_path, *args):
resource_path = opj(mod_path, *args)
if os.path.isdir(mod_path):
# the module is a directory - ignore zip behavior
if os.path.exists(resource_path):
return resource_path
if os.path.exists(resource_path):
return resource_path
return False
# backwards compatibility