Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Base

Entity: res.company

Compute Method: _compute_uninstalled_l10n_module_ids

View 18.0
Inputs Method Outputs
  • country_id
  • country_id.ids
  • country_id.id
+ self.env['ir.module.module'].flush_model(['auto_install', 'country_ids', 'dependencies_id'])
+ self.env['ir.module.module.dependency'].flush_model()
+ self.env.cr.execute("""
+             SELECT country.id,
+                    ARRAY_AGG(module.id)
+               FROM ir_module_module module,
+                    res_country country
+              WHERE module.auto_install
+                AND state NOT IN %(install_states)s
+                AND NOT EXISTS (
+                        SELECT 1
+                          FROM ir_module_module_dependency d
+                          JOIN ir_module_module mdep ON (d.name = mdep.name)
+                         WHERE d.module_id = module.id
+                           AND d.auto_install_required
+                           AND mdep.state NOT IN %(install_states)s
+                    )
+                AND EXISTS (
+                        SELECT 1
+                          FROM module_country mc
+                         WHERE mc.module_id = module.id
+                           AND mc.country_id = country.id
+                    )
+                AND country.id = ANY(%(country_ids)s)
+           GROUP BY country.id
+         """, {
+             'country_ids': self.country_id.ids,
+             'install_states': ('installed', 'to install', 'to upgrade'),
+         })
+ mapping = dict(self.env.cr.fetchall())
+ for company in self:
+             company.uninstalled_l10n_module_ids = self.env['ir.module.module'].browse(mapping.get(company.country_id.id))
  • uninstalled_l10n_module_ids

Back to entity