[FIX] sale_purchase: Take into account minimal quantity supplierinfo

closes odoo/odoo#53548

X-original-commit: d872cbf11f05cd10aa9b36b3c0aded895e0e68f3
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
This commit is contained in:
Carlos Dauden
2020-06-24 08:44:59 +00:00
committed by Arnold Moyaux
parent 6bd8e89766
commit fdc20d13bb
+1 -2
View File
@@ -266,8 +266,7 @@ class SaleOrderLine(models.Model):
for line in self:
line = line.with_company(line.company_id)
# determine vendor of the order (take the first matching company and product)
# VFE fixme why isn't the _select_seller function used ???
suppliers = line.product_id.seller_ids.filtered(lambda vendor: (not vendor.company_id or vendor.company_id == line.company_id) and (not vendor.product_id or vendor.product_id == line.product_id))
suppliers = line.product_id._select_seller(quantity=line.product_uom_qty, uom_id=line.product_uom)
if not suppliers:
raise UserError(_("There is no vendor associated to the product %s. Please define a vendor for this product.") % (line.product_id.display_name,))
supplierinfo = suppliers[0]