diff --git a/addons/mrp/i18n/mrp.pot b/addons/mrp/i18n/mrp.pot index 0ba8dcb5763cf98b0bc66d166dcc0e567a88f46e..8a918dbcf76da3818f7c686d4fd496f7a89cebd5 100644 --- a/addons/mrp/i18n/mrp.pot +++ b/addons/mrp/i18n/mrp.pot @@ -2709,6 +2709,15 @@ msgstr "" msgid "Not to restrict or prefer quants, but informative." msgstr "" +#. module: mrp +#: code:addons/mrp/models/mrp_workcenter.py:0 +#, python-format +msgid "" +"Note that archived work center(s): '%s' is/are still linked to active Bill " +"of Materials, which means that operations can still be planned on it/them. " +"To prevent this, deletion of the work center is recommended instead." +msgstr "" + #. module: mrp #: model:ir.model.fields,field_description:mrp.field_mrp_bom__message_needaction_counter #: model:ir.model.fields,field_description:mrp.field_mrp_production__message_needaction_counter diff --git a/addons/mrp/models/mrp_workcenter.py b/addons/mrp/models/mrp_workcenter.py index d55aa9eee1c59e03177b52719f33f58e4f16a6df..1e88dd0d1dbd6714d4be6be3ce451b5e0f77c9dd 100644 --- a/addons/mrp/models/mrp_workcenter.py +++ b/addons/mrp/models/mrp_workcenter.py @@ -253,6 +253,23 @@ class MrpWorkcenter(models.Model): remaining -= interval_minutes return False, 'Not available slot 700 days after the planned start' + def action_archive(self): + res = super().action_archive() + filtered_workcenters = ", ".join(workcenter.name for workcenter in self.filtered('routing_line_ids')) + if filtered_workcenters: + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'title': _("Note that archived work center(s): '%s' is/are still linked to active Bill of Materials, which means that operations can still be planned on it/them. " + "To prevent this, deletion of the work center is recommended instead.", filtered_workcenters), + 'type': 'warning', + 'sticky': True, #True/False will display for few seconds if false + 'next': {'type': 'ir.actions.act_window_close'}, + }, + } + return res + class MrpWorkcenterProductivityLossType(models.Model): _name = "mrp.workcenter.productivity.loss.type"