From cafd488883f04bcdfe76178e9b17fdeb86e34076 Mon Sep 17 00:00:00 2001 From: Adrien Widart Date: Thu, 13 Jan 2022 10:01:23 +0000 Subject: [PATCH] [FIX] stock: convert product description In some cases, the SM description is incorrect To reproduce the issue: 1. Create a product P 2. Create a receipt with 1 x P Error: The description of the SM is incorrect: `


`. It should be the name of P Another example: 1. Create a product P: - Internal Notes: "Lorem Ipsum" 2. Create a receipt with 1 x P Error: The description of the SM is incorrect: `

Lorem ipsum

`. It should be "Lorem Ipsum" Since [1], `product_template.description` is a HTML field. [1] bea5790713020209e0527840b7dbc1ea4806b762 OPW-2732208 closes odoo/odoo#82917 X-original-commit: 73f05114307b6ec6590da22903751ab79e7efa90 Signed-off-by: Arnold Moyaux Signed-off-by: Adrien Widart --- addons/stock/models/product.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/stock/models/product.py b/addons/stock/models/product.py index ff5668e38c8..282e41759c5 100644 --- a/addons/stock/models/product.py +++ b/addons/stock/models/product.py @@ -11,6 +11,7 @@ from odoo.exceptions import UserError from odoo.osv import expression from odoo.tools import float_is_zero from odoo.tools.float_utils import float_round +from odoo.tools.mail import html2plaintext, is_html_empty OPERATORS = { '<': py_operator.lt, @@ -233,7 +234,7 @@ class Product(models.Model): """ self.ensure_one() picking_code = picking_type_id.code - description = self.description or self.name + description = html2plaintext(self.description) if not is_html_empty(self.description) else self.name if picking_code == 'incoming': return self.description_pickingin or description if picking_code == 'outgoing':