From a9072210f2d6c7b41e60dfcba04c72c3be815705 Mon Sep 17 00:00:00 2001 From: pedrambiria Date: Fri, 21 Oct 2022 14:57:13 +0000 Subject: [PATCH] [FIX] pos_restaurant: load the lot/serial number correctly Before this commit: if you use the lot/serial number for the products, it won't load correctly through the UI. closes odoo/odoo#103940 Issue: https://github.com/odoo/odoo/issues/100888 X-original-commit: 0e2ea5ff786185a72916e5582fdbf45271819b8c Signed-off-by: Trinh Jacky (trj) --- addons/pos_restaurant/models/pos_order.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/pos_restaurant/models/pos_order.py b/addons/pos_restaurant/models/pos_order.py index ec262bc2ebc..a25c372910b 100644 --- a/addons/pos_restaurant/models/pos_order.py +++ b/addons/pos_restaurant/models/pos_order.py @@ -45,7 +45,7 @@ class PosOrder(models.Model): del pack_lot['id'] for order_line_id, pack_lot_ids in groupby(pack_lots, key=lambda x:x['order_line']): - next(order_line for order_line in order_lines if order_line['id'] == order_line_id)['pack_lot_ids'] = list(pack_lots) + next(order_line for order_line in order_lines if order_line['id'] == order_line_id)['pack_lot_ids'] = list(pack_lot_ids) def _get_fields_for_order_line(self): fields = super(PosOrder, self)._get_fields_for_order_line() @@ -88,6 +88,8 @@ class PosOrder(models.Model): del order_line['id'] if not 'pack_lot_ids' in order_line: order_line['pack_lot_ids'] = [] + else: + order_line['pack_lot_ids'] = [[0, 0, lot] for lot in order_line['pack_lot_ids']] extended_order_lines.append([0, 0, order_line]) for order_id, order_lines in groupby(extended_order_lines, key=lambda x:x[2]['order_id']):