From 411dd85a80ac4aa93753465dc3cc96f74a8eb72b Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 3 Feb 2020 12:42:48 +0000 Subject: [PATCH] [FIX] purchase: vendor reference - Create a product A MTO, Buy Add a supplier S1 and set a specific reference - Create a product B MTO, Buy Add a supplier S2 and set a specific reference - Create a SO with A & B, confirm - 2 RFQ are created The first RFQ is created with the correct reference, but not the second one. This is because `display_name` depends on context keys: it is computed once for both products with `partner_id` set as `S1`, while it should be recomputed for product B with `partner_id` set as `S2`. In order to avoid this, we use `with_prefetch()` to avoid reusing the prefetched value. opw-2176638 closes odoo/odoo#44564 X-original-commit: d96c1910be8f242455de9b443fc9db82155b4dd1 Signed-off-by: Nicolas Martinelli (nim) --- addons/purchase/models/purchase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/models/purchase.py b/addons/purchase/models/purchase.py index 1814799f97e..a05edfedbf1 100644 --- a/addons/purchase/models/purchase.py +++ b/addons/purchase/models/purchase.py @@ -779,7 +779,7 @@ class PurchaseOrderLine(models.Model): price_unit = seller.currency_id._convert( price_unit, po.currency_id, po.company_id, po.date_order or fields.Date.today()) - product_lang = product_id.with_context( + product_lang = product_id.with_prefetch().with_context( lang=partner.lang, partner_id=partner.id, )