diff --git a/mgmtsystem/__manifest__.py b/mgmtsystem/__manifest__.py index b4a9838d6b8..eebc6d02c16 100644 --- a/mgmtsystem/__manifest__.py +++ b/mgmtsystem/__manifest__.py @@ -3,6 +3,7 @@ { "name": "Management System", + "summary": "Support for management systems, such as ISO compliance.", "version": "18.0.1.0.0", "author": "Savoir-faire Linux,Odoo Community Association (OCA)", "website": "https://github.com/OCA/management-system", diff --git a/mgmtsystem/models/res_config.py b/mgmtsystem/models/res_config.py index 6b61d886019..6715a821ee6 100644 --- a/mgmtsystem/models/res_config.py +++ b/mgmtsystem/models/res_config.py @@ -1,7 +1,7 @@ # Copyright (C) 2004-2012 OpenERP S.A. (). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import fields, models +from odoo import _, exceptions, fields, models class MgmtsystemConfigSettings(models.TransientModel): @@ -107,3 +107,20 @@ class MgmtsystemConfigSettings(models.TransientModel): help="Provide Work Instructions category.\n" "- This installs the module document_page_work_instruction.", ) + + def execute(self): + # Provide error in case the odule to install is not available in the system + # This avoids user confusion from the install failing silently + self = self.with_context(active_test=False) + classified = self._get_classified_fields() + to_install = [ + f[7:] for f in self._fields.keys() if f.startswith("module_") and self[f] + ] + available = classified["module"].mapped("name") + not_available = set(to_install) - set(available) + if not_available: + raise exceptions.UserError( + _("The following modules are not available: %s") + % ", ".join(not_available) + ) + return super().execute()