From e05333f8f5bdf5e965c9eb1dd5e66e050f4dc36f Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Thu, 23 Mar 2017 15:15:46 +0100 Subject: [PATCH] [FIX] mrp: layout issue in workorder messages The alert box was flickering if empty: at each click on the status button, the box was appearing and disappearing quickly. This is probably due to a bug in the form view that do not wait for the evaluation of the attrs. This bug is fixed in the new views, but only if the attrs is fixed. Indeed, as the attrs condition is attrs="{'invisible': [('production_messages', '=', False)]}" the field was never set to False. This is because the compute method was doing workorder.production_messages = "
".join(messages) So, even if `messages` was empty, production_messages will be set to ''. In [1]: 'aaa'.join([]) Out[1]: '' So we fix the condition to set False to the field if the string is empty. In [6]: 'aaa'.join([]) or False Out[6]: False --- addons/mrp/models/mrp_workorder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp/models/mrp_workorder.py b/addons/mrp/models/mrp_workorder.py index 23cd851b780..b9e4ea18d74 100644 --- a/addons/mrp/models/mrp_workorder.py +++ b/addons/mrp/models/mrp_workorder.py @@ -163,7 +163,7 @@ class MrpWorkorder(models.Model): ('bom_id', '=', workorder.production_id.bom_id.id), ('routing_id', '=', workorder.operation_id.routing_id.id)] messages = ProductionMessage.search(domain).mapped('message') - workorder.production_messages = "
".join(messages) + workorder.production_messages = "
".join(messages) or False @api.multi def _compute_scrap_move_count(self):