From 7e21192b2b42a7245ec9bd183e59d8c201424ea2 Mon Sep 17 00:00:00 2001 From: William Henrotin Date: Thu, 30 Jan 2020 12:39:49 +0000 Subject: [PATCH] [FIX] mrp: show 'check_availability' button after reservation Due to the setting `ready_to_produce` = `asap` on Bill of Material. The Check Availability button could be hidden even if some stock moves are still in confirmed state. Task : 2121714 closes odoo/odoo#41631 Related: odoo/enterprise#7253 Signed-off-by: Simon Lejeune (sle) --- addons/mrp/models/mrp_production.py | 6 +++++- addons/mrp/views/mrp_production_views.xml | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index 84af8642414..355130b7420 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -184,8 +184,11 @@ class MrpProduction(models.Model): string="Stock Movements of Produced Goods") unreserve_visible = fields.Boolean( - 'Allowed to Unreserve Inventory', compute='_compute_unreserve_visible', + 'Allowed to Unreserve Production', compute='_compute_unreserve_visible', help='Technical field to check when we can unreserve') + reserve_visible = fields.Boolean( + 'Allowed to Reserve Production', compute='_compute_unreserve_visible', + help='Technical field to check when we can reserve quantities') post_visible = fields.Boolean( 'Allowed to Post Inventory', compute='_compute_post_visible', help='Technical field to check when we can post') @@ -421,6 +424,7 @@ class MrpProduction(models.Model): already_reserved = order.is_locked and order.state not in ('done', 'cancel') and order.mapped('move_raw_ids.move_line_ids') any_quantity_done = any([m.quantity_done > 0 for m in order.move_raw_ids]) order.unreserve_visible = not any_quantity_done and already_reserved + order.reserve_visible = order.state in ('confirmed', 'planned') and any(move.state == 'confirmed' for move in order.move_raw_ids) @api.depends('move_finished_ids.quantity_done', 'move_finished_ids.state', 'is_locked') def _compute_post_visible(self): diff --git a/addons/mrp/views/mrp_production_views.xml b/addons/mrp/views/mrp_production_views.xml index 803e29c28e1..327a615d590 100644 --- a/addons/mrp/views/mrp_production_views.xml +++ b/addons/mrp/views/mrp_production_views.xml @@ -50,7 +50,7 @@