From 831744684c3a23c1024714b380438b30a1c92099 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 26 Jun 2017 14:02:46 +0200 Subject: [PATCH] [FIX] stock: empty state - Update view with external_id=stock.view_move_picking_tree and remove editable attribute on the tree view. - Create a new picking - Add a line (form view will open) and click on "Save and close" => A traceback show up since 'scrapped' was not in the form view. - The picking location fields become readonly, and the status bar disappears - Save the picking => Error: "creation/update: a mandatory field is not correctly set : [object with reference: location_id - location.id]" Courtesy of @benwillig Closes #17738 opw-748353 --- addons/stock/models/stock_picking.py | 4 ++-- addons/stock/views/stock_move_views.xml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index 40121b2aae5..401258e5aed 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -325,11 +325,11 @@ class Picking(models.Model): .filtered(lambda move: move.state not in ['cancel', 'done'])\ .sorted(key=lambda move: (move.state == 'assigned' and 2) or (move.state == 'waiting' and 1) or 0) if self.move_type == 'one': - self.state = moves_todo[0].state + self.state = moves_todo[0].state or 'draft' elif moves_todo[0].state != 'assigned' and any(x.partially_available or x.state == 'assigned' for x in moves_todo): self.state = 'partially_available' else: - self.state = moves_todo[-1].state + self.state = moves_todo[-1].state or 'draft' @api.one @api.depends('move_lines.priority') diff --git a/addons/stock/views/stock_move_views.xml b/addons/stock/views/stock_move_views.xml index a49dc87dd7c..3d92f99a3b4 100644 --- a/addons/stock/views/stock_move_views.xml +++ b/addons/stock/views/stock_move_views.xml @@ -157,6 +157,7 @@
+