[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:
parent
fdc6ba1820
commit
9d2dbda8ca
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue