From 9d2dbda8cacbdefecd530e3e43049b5fc55e7a7d Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 11 May 2015 13:20:06 +0200 Subject: [PATCH] [FIX] stock_dropshipping: not enough stock warning for MTOs When 'stock_dropshipping' was installed, in a sale order, choosing a product being stockable + buy + MTOs returned the "Not Enough Stock" warning, while it shouldn't. It's because the according method `_check_rounting` was overriden in this module, with a @api.one, which aggregates, while the method expects to return a simple boolean even for a list of multiple ids. Converting the method to @api.multi solves the issue. opw-639426 --- addons/stock_dropshipping/stock_dropshipping.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/addons/stock_dropshipping/stock_dropshipping.py b/addons/stock_dropshipping/stock_dropshipping.py index cbd079263ca..2fe37ea8565 100644 --- a/addons/stock_dropshipping/stock_dropshipping.py +++ b/addons/stock_dropshipping/stock_dropshipping.py @@ -6,16 +6,17 @@ from openerp import models, api class sale_order_line(models.Model): _inherit = 'sale.order.line' - @api.one + @api.multi def _check_routing(self, product, warehouse): """ skip stock verification if the route goes from supplier to customer As the product never goes in stock, no need to verify it's availibility """ res = super(sale_order_line, self)._check_routing(product, warehouse) if not res: - for pull_rule in self.route_id.pull_ids: - if (pull_rule.picking_type_id.default_location_src_id.usage == 'supplier' and - pull_rule.picking_type_id.default_location_dest_id.usage == 'customer'): - res = True - break + for line in self: + for pull_rule in line.route_id.pull_ids: + if (pull_rule.picking_type_id.default_location_src_id.usage == 'supplier' and + pull_rule.picking_type_id.default_location_dest_id.usage == 'customer'): + res = True + break return res