Skip to content
Snippets Groups Projects
Commit 4fdacf49 authored by Carlos Dauden's avatar Carlos Dauden Committed by Arnold Moyaux
Browse files

[FIX] sale_purchase: Take into account minimal quantity supplierinfo


closes odoo/odoo#53081

X-original-commit: 9c5e4c6b
Signed-off-by: default avatarArnold Moyaux <amoyaux@users.noreply.github.com>
Signed-off-by: default avatarSimon Lejeune (sle) <sle@openerp.com>
parent aaac93b5
No related branches found
No related tags found
No related merge requests found
......@@ -257,8 +257,8 @@ class SaleOrderLine(models.Model):
for line in self:
line = line.with_context(force_company=line.company_id.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.with_context(force_company=line.company_id.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]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment