From bbc9ab9865c5093b8ab31f9cb9aeeaf9e72a974e Mon Sep 17 00:00:00 2001 From: Joseph Caburnay Date: Mon, 30 Sep 2019 09:11:37 +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#37571 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 ba75ef5236648..506df484bf21f 100644 --- a/addons/pos_restaurant/static/src/js/floors.js +++ b/addons/pos_restaurant/static/src/js/floors.js @@ -215,7 +215,12 @@ var TableWidget = PosBaseWidget.extend({ for (var field in table) { self.table[field] = table[field]; } - 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_popup('error',{