[FIX] pos_restaurant: product with no category

When computing the category count for the ActionpadWidget, it is
possible that a product does not have one. If it doesn't, we do not take
it into account in the category count. This implementation also fixes
the crash when opening an order with a order change with a product
without category.

closes odoo/odoo#129960

X-original-commit: 86c69c2f4f91bfc91871ca0c4f6ea5acff3c975c
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
This commit is contained in:
Adrien Guilliams (adgu)
2023-07-28 14:54:08 +02:00
parent 142d8e1177
commit c7b741ce04
@@ -56,6 +56,9 @@ patch(ActionpadWidget.prototype, "point_of_sale.ActionpadWidget", {
for (const idx in orderChange) {
const orderline = orderChange[idx];
const categoryId = this.pos.db.get_product_by_id(orderline.product_id).pos_categ_ids[0];
if (!categoryId) {
continue;
}
const category = this.pos.db.category_by_id[categoryId].name;
const numProd = orderline.quantity;
categories[category] = categories[category] ? categories[category] + numProd : numProd;