diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 0a757923616..acb5a675bce 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -326,11 +326,10 @@ class PurchaseOrder(models.Model): @api.multi def _create_picking(self): for order in self: - ptypes = order.order_line.mapped('product_id.type') - if ('product' in ptypes) or ('consu' in ptypes): + if any([ptype in ['product', 'consu'] for ptype in order.order_line.mapped('product_id.type')]): res = order._prepare_picking() picking = self.env['stock.picking'].create(res) - moves = order.order_line._create_stock_moves(picking) + moves = order.order_line.filtered(lambda r: r.product_id.type in ['product', 'consu'])._create_stock_moves(picking) moves.action_confirm() moves.force_assign() return True