[FIX] point_of_sale, pos_restaurant: order sequence

WHen you are creating a draft order, the sequence is not saved on the
server, and when we load the orders from the server the session id is
not correct too.

This leads to having inconsistant sequence numbers in the POS, almost
when we are synchronizing orders through the pos restaurant.

We now show the orders sequence number prefixed by login number when the
order is synchronized and don't have the same login number as current.

TASK-ID: 2057436

closes odoo/odoo#36032

Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This commit is contained in:
Pierre Masereel
2019-08-27 09:45:04 +00:00
parent e8d52e0025
commit 73d877eef2
3 changed files with 15 additions and 1 deletions
+1
View File
@@ -39,6 +39,7 @@ class PosOrder(models.Model):
'session_id': ui_order['pos_session_id'],
'lines': [process_line(l) for l in ui_order['lines']] if ui_order['lines'] else False,
'pos_reference': ui_order['name'],
'sequence_number': ui_order['sequence_number'],
'partner_id': ui_order['partner_id'] or False,
'date_order': ui_order['creation_date'].replace('T', ' ')[:19],
'fiscal_position_id': ui_order['fiscal_position_id'],
+1 -1
View File
@@ -139,7 +139,7 @@ class PosOrder(models.Model):
self._get_payment_lines(table_orders)
for order in table_orders:
order['pos_session_id'] = order['session_id']
order['pos_session_id'] = order['session_id'][0]
order['uid'] = order['pos_reference'].split(' ')[1]
order['name'] = order['pos_reference']
order['creation_date'] = order['create_date']
@@ -23,6 +23,19 @@
</t>
</t>
<t t-extend="OrderSelectorWidget">
<t t-jquery=".order-sequence" t-operation="replace">
<span class="order-sequence">
<t t-if="order.server_id &amp;&amp; widget.pos.pos_session.login_number != order.uid.split('-')[1]">
<t t-esc="order.uid.substring(order.uid.indexOf('-') +1)"/>
</t>
<t t-else="">
<t t-esc="order.sequence_number"/>
</t>
</span>
</t>
</t>
<t t-name="TableGuestsButton">
<div class='control-button'>
<span class='control-button-number'>