[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
This commit is contained in:
Denis Ledoux 2015-05-11 13:20:06 +02:00
parent fdc6ba1820
commit 9d2dbda8ca
1 changed files with 7 additions and 6 deletions

View File

@ -6,16 +6,17 @@ from openerp import models, api
class sale_order_line(models.Model): class sale_order_line(models.Model):
_inherit = 'sale.order.line' _inherit = 'sale.order.line'
@api.one @api.multi
def _check_routing(self, product, warehouse): def _check_routing(self, product, warehouse):
""" skip stock verification if the route goes from supplier to customer """ 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 As the product never goes in stock, no need to verify it's availibility
""" """
res = super(sale_order_line, self)._check_routing(product, warehouse) res = super(sale_order_line, self)._check_routing(product, warehouse)
if not res: if not res:
for pull_rule in self.route_id.pull_ids: for line in self:
if (pull_rule.picking_type_id.default_location_src_id.usage == 'supplier' and for pull_rule in line.route_id.pull_ids:
pull_rule.picking_type_id.default_location_dest_id.usage == 'customer'): if (pull_rule.picking_type_id.default_location_src_id.usage == 'supplier' and
res = True pull_rule.picking_type_id.default_location_dest_id.usage == 'customer'):
break res = True
break
return res return res