From 28c95f62bfb058d26f9b0e1960b2b7c0ab4f504c Mon Sep 17 00:00:00 2001 From: "Hansun (hale)" Date: Wed, 22 Feb 2023 08:47:10 +0000 Subject: [PATCH] [FIX] sale_purchase: show purchase description in RfQ autogeneration 1. Install [Manufacturing], [Sales], [Purchase] on Apps (ordered) 2. [Settings]>[Manufacturing]>[Subcontracting]: set 3. [Sales] - [CREATE] product type [Service] - On the tab 'Purchase' add a vendor, select [Subcontract Service] - On the same tab add `Purchase description` then save - [Orders]>[Quotations] - CREATE, add the subcontract service product and set customer - CONFIRM 4. [Purchase] - [Requests for Quotation] - should show on the top of the list if vendor was new. click - [Description] column does not show `Purchase description` Desired: show relevant data Impacted versions: 15 - master opw-3152072 closes odoo/odoo#113407 X-original-commit: fa33657e5e134a9f412a17da4082467ec847e395 Signed-off-by: Arnold Moyaux (arm) Signed-off-by: Lee, Hansun (hale) --- addons/sale_purchase/models/sale_order_line.py | 7 ++++++- addons/sale_purchase/tests/test_sale_purchase.py | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/sale_purchase/models/sale_order_line.py b/addons/sale_purchase/models/sale_order_line.py index d2806315ab3..e566200d5ca 100644 --- a/addons/sale_purchase/models/sale_order_line.py +++ b/addons/sale_purchase/models/sale_order_line.py @@ -177,8 +177,13 @@ class SaleOrderLine(models.Model): else: product_ctx.update({'partner_id': purchase_order.partner_id.id}) + product = self.product_id.with_context(**product_ctx) + name = product.display_name + if product.description_purchase: + name += '\n' + product.description_purchase + return { - 'name': self.product_id.with_context(**product_ctx).display_name, + 'name': name, 'product_qty': purchase_qty_uom, 'product_id': self.product_id.id, 'product_uom': self.product_id.uom_po_id.id, diff --git a/addons/sale_purchase/tests/test_sale_purchase.py b/addons/sale_purchase/tests/test_sale_purchase.py index bf79a3859a5..afd4d238064 100644 --- a/addons/sale_purchase/tests/test_sale_purchase.py +++ b/addons/sale_purchase/tests/test_sale_purchase.py @@ -227,6 +227,9 @@ class TestSalePurchase(TestCommonSalePurchaseNoChart): self.assertEqual(purchase_line2.product_qty, delta, "The quantity of the new PO line is the quantity added on the Sale Line, after first PO confirmation") def test_pol_description(self): + """ + test cases when product names are different from how the vendor refers to, which is allowed + """ service = self.env['product.product'].create({ 'name': 'Super Product', 'type': 'service',