[FIX] sale_stock: sale order picking form view
If there is only a single picking in the sales order, it will open formview, else it will open tree view for all pickings
This commit is contained in:
committed by
amoyaux
parent
08e92204b6
commit
3ee5a6af73
@@ -58,7 +58,13 @@ class SaleOrder(models.Model):
|
||||
view, if there is only one delivery order to show.
|
||||
'''
|
||||
action = self.env.ref('stock.action_picking_tree_all').read()[0]
|
||||
action['domain'] = [('id', 'in', self.picking_ids.ids)]
|
||||
|
||||
pickings = self.mapped('picking_ids')
|
||||
if len(pickings) > 1:
|
||||
action['domain'] = [('id', 'in', pickings.ids)]
|
||||
elif pickings:
|
||||
action['views'] = [(self.env.ref('stock.view_picking_form').id, 'form')]
|
||||
action['res_id'] = pickings.id
|
||||
return action
|
||||
|
||||
@api.multi
|
||||
|
||||
Reference in New Issue
Block a user