[IMP] pos_restaurant: allow re-ordering of the restaurant floors
This commit is contained in:
committed by
Frédéric van der Essen
parent
52c2f74e21
commit
4079c4afa0
@@ -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):
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
<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>
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user