'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):
<field name="model">restaurant.floor</field>
<field name="arch" type="xml">
<tree string="Restaurant Floors">
+ <field name="sequence" widget="handle" />
<field name="name" />
<field name="pos_config_id" />
</tree>
// 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;
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;
},