[FIX] stock: planned transfer

- Create a product A tracked by lot
- From the Dashboard, create a 'Planned Transfer'
- Add product A, any quantity
- Click on "Mark as TODO"

It's now possible to edit the serial numbers, but it's impossible to set
any quantity in the move lines.

This is due to the remaining context key `planned_picking` which makes
`is_initial_demand_editable = True`. In this case, `qty_done` is
read-only in the view `view_stock_move_line_operation_tree`.

As a workaround, `action_confirm` returns an action and set the context
accordingly.

opw-785332
This commit is contained in:
Nicolas Martinelli
2017-12-22 11:03:13 +01:00
committed by Nicolas Martinelli
parent 8836ad5274
commit ed8fc8f52b
+13 -1
View File
@@ -542,7 +542,19 @@ class Picking(models.Model):
# call `_action_assign` on every confirmed move which location_id bypasses the reservation
self.filtered(lambda picking: picking.location_id.usage in ('supplier', 'inventory', 'production') and picking.state == 'confirmed')\
.mapped('move_lines')._action_assign()
return True
if self.env.context.get('planned_picking') and len(self) == 1:
action = self.env.ref('stock.action_picking_form')
result = action.read()[0]
result['res_id'] = self.id
result['context'] = {
'search_default_picking_type_id': [self.picking_type_id.id],
'default_picking_type_id': self.picking_type_id.id,
'contact_display': 'partner_address',
'planned_picking': False,
}
return result
else:
return True
@api.multi
def action_assign(self):