From 0040a9f2df6637705d7e4a77b356e5f21874ac2d Mon Sep 17 00:00:00 2001 From: Frederic van der Essen Date: Thu, 17 Jul 2014 15:03:31 +0200 Subject: [PATCH] [IMP] point_of_sale: initial commit for the fullscreen mode. The fullscreen option will detect if the pos is displayed in fullscreen and if not will tell the user how to set it up for fullscreen, or propose to go fullscreen with the HTML5 Built-in API. The HTML5 API requires a click from the user to allow fullscreen, so the popup will pop everytime unless the user has setup kiosk-mode or native application emulation which makes the app start in real fullscreen. --- addons/point_of_sale/point_of_sale.py | 1 + addons/point_of_sale/point_of_sale_view.xml | 1 + addons/point_of_sale/static/src/css/pos.css | 2 +- .../static/src/img/ios-share-icon.png | Bin 0 -> 522 bytes addons/point_of_sale/static/src/js/screens.js | 20 ++++++++ addons/point_of_sale/static/src/js/widgets.js | 8 ++++ addons/point_of_sale/static/src/xml/pos.xml | 45 ++++++++++++++++++ 7 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 addons/point_of_sale/static/src/img/ios-share-icon.png diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 5c8103c7626..b3ff62a7994 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -72,6 +72,7 @@ class pos_config(osv.osv): 'iface_scan_via_proxy' : fields.boolean('Scan via Proxy', help="Enable barcode scanning with a remotely connected barcode scanner"), 'iface_invoicing': fields.boolean('Invoicing',help='Enables invoice generation from the Point of Sale'), 'iface_big_scrollbars': fields.boolean('Large Scrollbars',help='For imprecise industrial touchscreens'), + 'iface_fullscreen': fields.boolean('Fullscreen', help='Display the Point of Sale in full screen mode'), 'receipt_header': fields.text('Receipt Header',help="A short text that will be inserted as a header in the printed receipt"), 'receipt_footer': fields.text('Receipt Footer',help="A short text that will be inserted as a footer in the printed receipt"), 'proxy_ip': fields.char('IP Address', help='The hostname or ip address of the hardware proxy, Will be autodetected if left empty', size=45), diff --git a/addons/point_of_sale/point_of_sale_view.xml b/addons/point_of_sale/point_of_sale_view.xml index 07ec934318e..91707e648ab 100644 --- a/addons/point_of_sale/point_of_sale_view.xml +++ b/addons/point_of_sale/point_of_sale_view.xml @@ -658,6 +658,7 @@ + diff --git a/addons/point_of_sale/static/src/css/pos.css b/addons/point_of_sale/static/src/css/pos.css index 30939636b23..b9c9605ed92 100644 --- a/addons/point_of_sale/static/src/css/pos.css +++ b/addons/point_of_sale/static/src/css/pos.css @@ -1663,7 +1663,7 @@ td { .pos .popup .comment{ font-weight: normal; font-size: 18px; - margin: 0px 16px; + margin: 0px 16px 16px 16px; } .pos .popup .footer{ position:absolute; diff --git a/addons/point_of_sale/static/src/img/ios-share-icon.png b/addons/point_of_sale/static/src/img/ios-share-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..8588657e12373ac3fc6737dadf53deb15f2ff44c GIT binary patch literal 522 zcmV+l0`>igP)iX5@`nTBoq0IZR)cb+F{AREH_4fI$())b6{7$0%F_ZpEp#3C_ z{ttrxe7XD#fd2!0|00b30($>Uq5Ttt{|SEoCXW6YhyEOh{yv)iJemF;iv9e^!b3h z{N(TY!rc12+WL^h`{3;QyxRLVmi}C-{g1@_h`{^5-1_70`RMTZ&g1%Nu>F(9`)IKI zpUnHv<@%Y(`=ieL$>I9r?)uN<`XY<|27Ui@wfq;P<6Zy&010qNS#tmY4#NNd4#NS* zZ>VGd000McNliru-Uks3DGn5YaGd}E0C!15K~y-)V_={*U}wQE&nqg3R|T)EqC7qo zyy`~$CI+}wcqn=@@Y}gs+wK%#=V?!EcFfg}&X0R^Y)zKmi;KPX&5*XaG%tlRgFrW}p`U0G$INf0q5oqyPW_ M07*qoM6N<$g1Pr4*Z=?k literal 0 HcmV?d00001 diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index 48fa00e1d70..b326a6326be 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -314,6 +314,26 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa }); + module.FullscreenPopup = module.PopUpWidget.extend({ + template:'FullscreenPopupWidget', + show: function(){ + var self = this; + this._super(); + this.renderElement(); + this.$('.button.fullscreen').off('click').click(function(){ + window.document.body.webkitRequestFullscreen(); + self.pos_widget.screen_selector.close_popup(); + }); + this.$('.button.cancel').off('click').click(function(){ + self.pos_widget.screen_selector.close_popup(); + }); + }, + ismobile: function(){ + return typeof window.orientation !== 'undefined'; + } + }); + + module.ChooseReceiptPopupWidget = module.PopUpWidget.extend({ template:'ChooseReceiptPopupWidget', show: function(){ diff --git a/addons/point_of_sale/static/src/js/widgets.js b/addons/point_of_sale/static/src/js/widgets.js index 5db12165737..72a6f7f1d49 100644 --- a/addons/point_of_sale/static/src/js/widgets.js +++ b/addons/point_of_sale/static/src/js/widgets.js @@ -1001,6 +1001,10 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa self.screen_selector.show_popup('error', 'Sorry, we could not create a user session'); }else if(!self.pos.config){ self.screen_selector.show_popup('error', 'Sorry, we could not find any PoS Configuration for this session'); + }else if(self.pos.config.iface_fullscreen && document.body.webkitRequestFullscreen && ( + window.screen.availWidth > window.innerWidth || + window.screen.availHeight > window.innerHeight )){ + self.screen_selector.show_popup('fullscreen'); } self.$('.loader').animate({opacity:0},1500,'swing',function(){self.$('.loader').addClass('oe_hidden');}); @@ -1085,6 +1089,9 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa this.confirm_popup = new module.ConfirmPopupWidget(this,{}); this.confirm_popup.appendTo(this.$el); + this.fullscreen_popup = new module.FullscreenPopup(this,{}); + this.fullscreen_popup.appendTo(this.$el); + // -------- Misc --------- this.close_button = new module.HeaderButtonWidget(this,{ @@ -1140,6 +1147,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa 'error-no-client': this.error_no_client_popup, 'error-invoice-transfer': this.error_invoice_transfer_popup, 'confirm': this.confirm_popup, + 'fullscreen': this.fullscreen_popup, }, default_screen: 'products', default_mode: 'cashier', diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index 929212cce8d..6f6be86b6d4 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -586,6 +586,51 @@ + + + +