[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
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -157,6 +157,7 @@
|
||||
<header>
|
||||
<field name="state" widget="statusbar"/>
|
||||
</header>
|
||||
<field name="scrapped" invisible="1"/>
|
||||
<group>
|
||||
<group string="#Products">
|
||||
<field name="product_id"/>
|
||||
|
||||
Reference in New Issue
Block a user