From a9adfbaa186236dc9fa10ece5338a9b505f4e2fa Mon Sep 17 00:00:00 2001 From: fw-bot Date: Mon, 7 Oct 2019 11:19:32 +0000 Subject: [PATCH] [FIX] pos_restaurant: faulty behavior of newly created table When a table is created, the new table appears to be selected but the capability to resize and drag is not active. As a result, when this new table is dragged, it is unselected instead. This is because of the call of `save_changes`. The table widget is rendered but the event handlers for resizing and dragging are not assigned. After this commit, the created table can be resized and dragged immediately after creation. closes odoo/odoo#38068 Signed-off-by: Nicolas Martinelli (nim) --- addons/pos_restaurant/static/src/js/floors.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/pos_restaurant/static/src/js/floors.js b/addons/pos_restaurant/static/src/js/floors.js index b36a169312f..f7de936b526 100644 --- a/addons/pos_restaurant/static/src/js/floors.js +++ b/addons/pos_restaurant/static/src/js/floors.js @@ -217,7 +217,12 @@ var TableWidget = PosBaseWidget.extend({ self.table[field] = table[field]; } self.pos.tables_by_id[table.id] = self.table; - self.renderElement(); + // If selected, render with drag and resize event handlers. + if (!self.selected) { + self.renderElement(); + } else { + self.select(); + } }); }, function(type,err) { self.gui.show_sync_error_popup();