From ef86e6a816dfee7db8baa14924bc909b78e6dcda Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Wed, 27 Sep 2017 11:00:16 +0200 Subject: [PATCH] [IMP] mrp: only show reserved when no show operations on picking type Because the stock.move.line view (when Show Operations is checked on the picking type) does not take into account the show reserved setting on the picking type, it is better not to show the checkbox when show operations is checked. We add an onchange to always check the "show reserved" settings when "show operaions" is checked. --- addons/stock/models/stock_picking.py | 5 +++++ addons/stock/views/stock_picking_views.xml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index 2042241d5dd..b6e61c05f49 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -134,6 +134,11 @@ class PickingType(models.Model): self.default_location_src_id = self.env.ref('stock.stock_location_stock').id self.default_location_dest_id = self.env.ref('stock.stock_location_customers').id + @api.onchange('show_operations') + def onchange_show_operations(self): + if self.show_operations is True: + self.show_reserved = True + def _get_action(self, action_xmlid): # TDE TODO check to have one view + custo in methods action = self.env.ref(action_xmlid).read()[0] diff --git a/addons/stock/views/stock_picking_views.xml b/addons/stock/views/stock_picking_views.xml index b0f9cd95d38..2de2d876d9f 100644 --- a/addons/stock/views/stock_picking_views.xml +++ b/addons/stock/views/stock_picking_views.xml @@ -47,7 +47,7 @@ - +