From 7bbba71bdaea5d35be50f1f321f417c50dd4eb94 Mon Sep 17 00:00:00 2001 From: "Pedram (PEBR)" Date: Mon, 20 Nov 2023 16:51:29 +0100 Subject: [PATCH] [FIX] point_of_sale: Include uncategorized products in sales report Prior to this commit, products without assigned categories were not displayed in the sales details report. This issue was due to the report's logic excluding products that did not fall under any specific POS category. This commit introduces a change where products without categories are now considered under a default category named "Not Categorized" in the sales report. This ensures that all products, regardless of category status, are accounted for and visible in the sales details, improving the comprehensiveness and accuracy of the report. opw-3594985 closes odoo/odoo#143440 X-original-commit: 6b7afc9f16133314ff6247f11db002bd3a64d289 Signed-off-by: Joseph Caburnay (jcb) Signed-off-by: Pedram Bi Ria (pebr) --- addons/point_of_sale/i18n/point_of_sale.pot | 7 +++++++ addons/point_of_sale/models/report_sale_details.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/point_of_sale/i18n/point_of_sale.pot b/addons/point_of_sale/i18n/point_of_sale.pot index f00387f1531..ce56c073bc7 100644 --- a/addons/point_of_sale/i18n/point_of_sale.pot +++ b/addons/point_of_sale/i18n/point_of_sale.pot @@ -3828,6 +3828,13 @@ msgstr "" msgid "None" msgstr "" +#. module: point_of_sale +#. odoo-python +#: code:addons/point_of_sale/models/report_sale_details.py:0 +#, python-format +msgid "Not Categorized" +msgstr "" + #. module: point_of_sale #: model_terms:ir.ui.view,arch_db:point_of_sale.view_report_pos_order_search msgid "Not Invoiced" diff --git a/addons/point_of_sale/models/report_sale_details.py b/addons/point_of_sale/models/report_sale_details.py index 9ae3202ed3f..3bb32b8b869 100644 --- a/addons/point_of_sale/models/report_sale_details.py +++ b/addons/point_of_sale/models/report_sale_details.py @@ -282,7 +282,7 @@ class ReportSaleDetails(models.AbstractModel): def _get_products_and_taxes_dict(self, line, products, taxes, currency): key2 = (line.product_id, line.price_unit, line.discount) - keys1 = line.product_id.product_tmpl_id.pos_categ_ids.mapped("name") + keys1 = line.product_id.product_tmpl_id.pos_categ_ids.mapped("name") or [_('Not Categorized')] for key1 in keys1: products.setdefault(key1, {}) products[key1].setdefault(key2, 0.0)