[FIX] product, purchase, sale: fix default productType traceback

The linked PR: https://github.com/odoo/odoo/pull/155157/files

Added a default props 'productType' for ProductCatalogOrderLines, the value of this prop wasn't loaded by the backend correctly
resulting in a traceback when in debug mode and trying to open the catalog from sale/fsm
and another traceback when trying to open the catalog from the purchase form

This PR loads the type of the product into the dictionnary corretly

closes odoo/odoo#161541

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
Bastien (bvdn)
2024-04-12 15:27:50 +00:00
parent e7ab65ab6c
commit 87f1106e5a
3 changed files with 3 additions and 3 deletions
@@ -96,7 +96,7 @@ class ProductCatalogMixin(models.AbstractModel):
for product, record_lines in self._get_product_catalog_record_lines(product_ids).items():
order_line_info[product.id] = {
**record_lines._get_product_catalog_lines_data(parent_record=self, **kwargs),
**record_lines._get_product_catalog_lines_data(**kwargs),
'productType': product.type,
}
product_ids.remove(product.id)
+1 -1
View File
@@ -846,7 +846,7 @@ class PurchaseOrder(models.Model):
def _get_product_catalog_order_data(self, products, **kwargs):
res = super()._get_product_catalog_order_data(products, **kwargs)
for product in products:
res[product.id] += self._get_product_price_and_data(product)
res[product.id] |= self._get_product_price_and_data(product)
return res
def _get_product_catalog_record_lines(self, product_ids):
+1 -1
View File
@@ -1824,7 +1824,7 @@ class SaleOrder(models.Model):
)
res = super()._get_product_catalog_order_data(products, **kwargs)
for product in products:
res[product.id] = {'price': pricelist.get(product.id)}
res[product.id]['price'] = pricelist.get(product.id)
if product.sale_line_warn != 'no-message' and product.sale_line_warn_msg:
res[product.id]['warning'] = product.sale_line_warn_msg
if product.sale_line_warn == "block":