diff --git a/pos_change_table/__init__.py b/pos_change_table/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/pos_change_table/__openerp__.py b/pos_change_table/__openerp__.py new file mode 100644 index 000000000..8b40490c0 --- /dev/null +++ b/pos_change_table/__openerp__.py @@ -0,0 +1,25 @@ +{ + 'name' : 'POS Change Table', + 'version': '1.0', + 'category': 'POS', + 'summary': "Change Table of Order in POS ", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'website': 'http://www.cybrosys.com', + 'description': """ + + +======================= + + +""", + 'depends': ['point_of_sale', 'pos_restaurant','base'], + 'data': [ + 'template.xml' + ], + + 'qweb': [ + "static/src/xml/table_change.xml", + ], + 'installable': True, +} \ No newline at end of file diff --git a/pos_change_table/static/description/change_table.png b/pos_change_table/static/description/change_table.png new file mode 100644 index 000000000..69b7b4acf Binary files /dev/null and b/pos_change_table/static/description/change_table.png differ diff --git a/pos_change_table/static/description/index.html b/pos_change_table/static/description/index.html new file mode 100644 index 000000000..212f8c9b4 --- /dev/null +++ b/pos_change_table/static/description/index.html @@ -0,0 +1,17 @@ +
+
+

Change Table in POS

+

+
+

+ This module allows you to change Table of an order from one to another by using 'change table' button in POS without cancelling the order. +

+

+
+
+
+ +
+
+
+
diff --git a/pos_change_table/static/src/css/pos.css b/pos_change_table/static/src/css/pos.css new file mode 100644 index 000000000..523983c10 --- /dev/null +++ b/pos_change_table/static/src/css/pos.css @@ -0,0 +1,97 @@ +.pos .clientlist-screen .deliveryperson-list{ + font-size: 16px; + width: 100%; + line-height: 40px; +} +.pos .clientlist-screen .deliveryperson-list th, +.pos .clientlist-screen .deliveryperson-list td { + padding: 0px 8px; +} +.pos .clientlist-screen .deliveryperson-list tr{ + transition: all 150ms linear; + background: rgb(230,230,230); +} +.pos .clientlist-screen .deliveryperson-list thead > tr, +.pos .clientlist-screen .deliveryperson-list tr:nth-child(even) { + background: rgb(247,247,247); +} +.pos .clientlist-screen .deliveryperson-list tr.highlight{ + transition: all 150ms linear; + background: rgb(110,200,155) !important; + color: white; +} +.pos .clientlist-screen .deliveryperson-list tr.lowlight{ + transition: all 150ms linear; + background: rgb(216, 238, 227); +} +.pos .clientlist-screen .deliveryperson-list tr.lowlight:nth-child(even){ + transition: all 150ms linear; + background: rgb(227, 246, 237); +} + +.floor-map .table .time-value { + position: absolute; + text-align: center; + background: blue; + margin-top: 5px; + height: 20px; + line-height: 20px; + border-radius: 1px; + font-size: 16px; + z-index: 10; + top: 8px; + left: 16px; + width: 70px; +} +.floor-map .table .round-time { + + top: 50px !important; + left: 70px !important; + +} + + + +.floor-map .table .order-value { + position: absolute; + text-align: center; + background: #0D823C; + margin-top: -50px; + margin-left: -10px; + height: 17px; + line-height: 17px; + border-radius: 10px; + z-index: 10; + left: 0px; + right: 0; + font-size: 12px; + margin: 0 12px; + bottom: 26px; + +} +.floor-map .table .round-value { + height: 20px !important; + margin: 0 55px !important; + line-height: 20px !important; + bottom: 65px !important; +} + + +.floor-map .table .labels { + display: block; + max-height: 100%; + overflow: hidden; + position: relative; + bottom: 4px; + z-index: 5; +} +.pos .order-button.change-floor-button .fa { + font-size: 24px; +} +.pos .order-button.change-floor-button { + font-weight: bold; + font-size: 16px; + min-width: 128px; + padding-left: 16px; + padding-right: 16px; +} \ No newline at end of file diff --git a/pos_change_table/static/src/js/floors.js b/pos_change_table/static/src/js/floors.js new file mode 100644 index 000000000..c9728f828 --- /dev/null +++ b/pos_change_table/static/src/js/floors.js @@ -0,0 +1,105 @@ +odoo.define('pos_change_table.floors', function (require) { +"use strict"; + var chrome = require('point_of_sale.chrome'); + var gui = require('point_of_sale.gui'); + var models = require('point_of_sale.models'); + var screens = require('point_of_sale.screens'); + var core = require('web.core'); + var QWeb = core.qweb; + var floor = require('pos_restaurant.floors'); + +// We need to modify the OrderSelector to hide itself when we're on +// the floor plan +chrome.OrderSelectorWidget.include({ + change_floor_button_click_handler: function(){ + this.pos.change_table = true; + this.pos.previous_order_id = this.pos.get_order(); + this.pos.set_table(null); + + }, + renderElement: function(){ + var self = this; + this._super(); + if (this.pos.config.iface_floorplan) { + if (this.pos.get_order()) { + if (this.pos.table && this.pos.table.floor) { + this.$('.orders').prepend(QWeb.render('ChangeFloorButton')); + this.$('.change-floor-button').click(function(){ + self.change_floor_button_click_handler(); + }); + } + this.$el.removeClass('oe_invisible'); + } else { + this.$el.addClass('oe_invisible'); + } + } + }, +}); + +// We need to change the way the regular UI sees the orders, it +// needs to only see the orders associated with the current table, +// and when an order is validated, it needs to go back to the floor map. +// +// And when we change the table, we must create an order for that table +// if there is none. +var _super_posmodel = models.PosModel.prototype; + +models.PosModel = models.PosModel.extend({ + initialize: function(session, attributes) { + this.change_table = false; + this.previous_order_id= false; + return _super_posmodel.initialize.call(this,session,attributes); + }, + + // changes the current table. + + set_table: function(table) { + if (this.change_table){ + if (!table) { // no table ? go back to the floor plan, see ScreenSelector + this.set_order(null); + } + else { + this.previous_order_id.table = table; + this.change_table = false; + // table ? load the associated orders ... + this.table = table; + var orders = this.get_order_list(); + if (orders.length) { + this.set_order(orders[0]); // and go to the first one ... + } else { + this.add_new_order(); // or create a new order with the current table + } + + } + + } + else{ + _super_posmodel.set_table.apply(this,arguments); + } + + + + if (!table) { // no table ? go back to the floor plan, see ScreenSelector + this.set_order(null); + } + else { + if(this.change_table){ + this.previous_order_id.table = table; + this.change_table = false; + } + // table ? load the associated orders ... + this.table = table; + var orders = this.get_order_list(); + if (orders.length) { + this.set_order(orders[0]); // and go to the first one ... + } else { + this.add_new_order(); // or create a new order with the current table + } + + } + }, + + + }); + +}); diff --git a/pos_change_table/static/src/xml/table_change.xml b/pos_change_table/static/src/xml/table_change.xml new file mode 100644 index 000000000..09caccbb4 --- /dev/null +++ b/pos_change_table/static/src/xml/table_change.xml @@ -0,0 +1,16 @@ + + + + + + + + + Change Table + + + + + + + diff --git a/pos_change_table/template.xml b/pos_change_table/template.xml new file mode 100644 index 000000000..550deb099 --- /dev/null +++ b/pos_change_table/template.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file