[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) <trj@odoo.com>
This commit is contained in:
pedrambiria
2022-10-24 15:12:53 +02:00
parent 4abe02f8fe
commit a9072210f2
+3 -1
View File
@@ -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']):