diff --git a/addons/pos_restaurant/restaurant.py b/addons/pos_restaurant/restaurant.py index 52f66e1cd0d..46affe5d397 100644 --- a/addons/pos_restaurant/restaurant.py +++ b/addons/pos_restaurant/restaurant.py @@ -35,6 +35,11 @@ class restaurant_floor(osv.osv): 'pos_config_id': fields.many2one('pos.config','Point of Sale'), 'background_image': fields.binary('Background Image', help='A background image used to display a floor layout in the point of sale interface'), 'table_ids': fields.one2many('restaurant.table','floor_id','Tables', help='The list of tables in this floor'), + 'sequence': fields.integer('Sequence',help='Used to sort Floors'), + } + + _defaults = { + 'sequence': 1, } class restaurant_table(osv.osv): diff --git a/addons/pos_restaurant/restaurant_view.xml b/addons/pos_restaurant/restaurant_view.xml index 38b24cd5f24..1baacaa8a15 100644 --- a/addons/pos_restaurant/restaurant_view.xml +++ b/addons/pos_restaurant/restaurant_view.xml @@ -31,6 +31,7 @@ restaurant.floor + diff --git a/addons/pos_restaurant/static/src/js/floors.js b/addons/pos_restaurant/static/src/js/floors.js index 0e1e0253f54..d329aa59d13 100644 --- a/addons/pos_restaurant/static/src/js/floors.js +++ b/addons/pos_restaurant/static/src/js/floors.js @@ -5,7 +5,7 @@ function openerp_restaurant_floors(instance,module){ // At POS Startup, load the floors, and add them to the pos model module.PosModel.prototype.models.push({ model: 'restaurant.floor', - fields: ['name','background_image','table_ids'], + fields: ['name','background_image','table_ids','sequence'], domain: function(self){ return [['pos_config_id','=',self.config.id]] }, loaded: function(self,floors){ self.floors = floors; @@ -14,6 +14,10 @@ function openerp_restaurant_floors(instance,module){ floors[i].tables = []; self.floors_by_id[floors[i].id] = floors[i]; } + + // Make sure they display in the correct order + self.floors = self.floors.sort(function(a,b){ return a.sequence - b.sequence; }); + // Ignore floorplan features if no floor specified, or feature deactivated self.config.iface_floorplan = self.config.iface_floorplan && !!self.floors.length; },