[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) <nim@odoo.com>
This commit is contained in:
fw-bot
2019-10-07 11:47:26 +00:00
committed by Joseph Caburnay
parent b5bc4dd46a
commit a9adfbaa18
@@ -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();