Skip to content
Snippets Groups Projects
Commit 6ed3c4bf authored by Joseph Caburnay's avatar Joseph Caburnay
Browse files

[FIX] pos_restaurant: random fails when transferring order to other table


To transfer an order from one table to another, we first select the order,
then we click the 'transfer button', then we are shown the table selection.
The moment we click the 'transfer button', two simultaneous rpc's are made
for the same method (`create_from_ui`). This method deletes and recreates
the orderlines in database. The 2nd request fails because of the deletion.
But despite the failure, the server retries the rpc after a random amount
of time in sec: `wait_time = random.uniform(0.0, 2 ** tries)`.
If the user immediately (within the `wait_time`) clicks the new table where
the order is to be placed, the problem happens - the transfer of order to
the new table fails. This is because of the 3rd rpc whose result is used
for the actual order transfer. If the 3rd rpc happens before the retry of
the second, the transfer fails.

The randomness of `wait_time` (time-to-retry rpc) results to the random
runbot error. The solution is to prevent the 2nd (redundant) request
because it is not actually needed. This commit tries to accomplish that.

closes odoo/odoo#57365

X-original-commit: af7e7899124d2d8e3d4526d7de1c93158878f6e6
Signed-off-by: default avatarChristophe Monniez (moc) <moc@odoo.com>
Signed-off-by: default avatarJoseph Caburnay (jcb) <caburj@users.noreply.github.com>
parent e10cbc79
No related branches found
No related tags found
No related merge requests found
......@@ -40,7 +40,9 @@ odoo.define('pos_restaurant.FloorScreen', function (require) {
this.floorMapRef.el.style.background = this.state.floorBackground;
}
mounted() {
this.env.pos.set_table(null);
if (this.env.pos.table) {
this.env.pos.set_table(null);
}
this.floorMapRef.el.style.background = this.state.floorBackground;
// call _tableLongpolling once then set interval of 5sec.
this._tableLongpolling();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment