[FIX] base_import_module: fix missing field name in non-debug mode

Before this commit, the website of the industry module ends with
`/False`. This is because the website of the module requires the name
of the module. It is therefore added in the _get_modules_from_apps
method.

closes odoo/odoo#152078

Signed-off-by: Pierre Masereel (pim) <pim@odoo.com>
This commit is contained in:
vava-odoo
2024-02-01 07:06:57 +00:00
parent ba3980e132
commit 873a13ef62
2 changed files with 4 additions and 2 deletions
@@ -318,6 +318,8 @@ class IrModule(models.Model):
@api.model
def _get_modules_from_apps(self, fields, module_type, module_name, domain=None, limit=None, offset=None):
if 'name' not in fields:
fields = fields + ['name']
payload = {
'params': {
'series': major_version,
@@ -334,7 +336,7 @@ class IrModule(models.Model):
resp.raise_for_status()
modules_list = resp.json().get('result', [])
for mod in modules_list:
module_name = mod.get('name', module_name)
module_name = mod['name']
existing_mod = self.search([('name', '=', module_name), ('state', '=', 'installed')])
mod['id'] = existing_mod.id if existing_mod else -1
if 'icon' in fields:
@@ -34,7 +34,7 @@
<field name="inherit_id" ref="base.module_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='category_id']" position="after">
<field name="module_type" invisible="1"/>
<field name="module_type" column_invisible="1"/>
</xpath>
</field>
</record>