From 850bb0a9d90c44a66e5acf0a4d9f869986a469b5 Mon Sep 17 00:00:00 2001 From: niyasraphy Date: Thu, 17 Nov 2022 17:07:37 +0000 Subject: [PATCH] [FIX] purchase_requisition: wrong seller in context to get supplier info the context passed to the method _get_product_purchase_description for the seller_id is wrong. system is expecting to get product.supplierinfo record set in this context key and from this function res.partner record set is passed, which results in the below error: Record does not exist or has been deleted. (Record: product.supplierinfo(70,), User: 2) closes odoo/odoo#105998 X-original-commit: 6e7f778e1d0dbe4795fa9446bfd3542ecec9815c Signed-off-by: Tiffany Chang --- addons/purchase_requisition/models/purchase.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/purchase_requisition/models/purchase.py b/addons/purchase_requisition/models/purchase.py index ce77127abef..51fdef54b9f 100644 --- a/addons/purchase_requisition/models/purchase.py +++ b/addons/purchase_requisition/models/purchase.py @@ -255,7 +255,14 @@ class PurchaseOrderLine(models.Model): if line.product_id == pol.product_id: pol.price_unit = line.product_uom_id._compute_price(line.price_unit, pol.product_uom) partner = pol.order_id.partner_id or pol.order_id.requisition_id.vendor_id - product_ctx = {'seller_id': partner.id, 'lang': get_lang(pol.env, partner.lang).code} + params = {'order_id': pol.order_id} + seller = pol.product_id._select_seller( + partner_id=partner, + quantity=self.product_qty, + date=pol.order_id.date_order and pol.order_id.date_order.date(), + uom_id=line.product_uom_id, + params=params) + product_ctx = {'seller_id': seller.id, 'lang': get_lang(pol.env, partner.lang).code} name = pol._get_product_purchase_description(pol.product_id.with_context(product_ctx)) if line.product_description_variants: name += '\n' + line.product_description_variants