[FIX] point_of_sale: products w/ unloaded category belong to root

It's possible that a product is loaded but its pos.category is not, e.g. when
loading a menu product (product with detailed_type='combo'), the components will
also be loaded.

In this case, the product's pos.category will be null and the product won't be
visible even when in the root category. This commit makes sure that if a
product's pos.category is not loaded, the product will be visible in the root
category.

Part-of: odoo/odoo#138352
This commit is contained in:
Joseph Caburnay
2023-10-13 23:20:15 +00:00
parent 14886eb662
commit c3e412aafd
@@ -102,7 +102,7 @@ export class PosDB {
/* returns a list of all ancestors (parent, grand-parent, etc) categories ids
* starting from the root category to the direct parent */
get_category_ancestors_ids(categ_id) {
return this.category_ancestors[categ_id] || [];
return this.category_ancestors[categ_id] || [this.root_category_id];
}
/* returns the parent category's id of a category, or the root_category_id if no parent.
* the root category is parent of itself. */