diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 9363afe01ea..fa7fcba6bf1 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -63,6 +63,7 @@ class pos_config(osv.osv): 'iface_electronic_scale' : fields.boolean('Electronic Scale Interface'), 'iface_vkeyboard' : fields.boolean('Virtual KeyBoard Interface'), 'iface_print_via_proxy' : fields.boolean('Print via Proxy'), + 'iface_invoicing': fields.boolean('Invoicing',help='Enables invoice generation from the Point of Sale'), 'state' : fields.selection(POS_CONFIG_STATE, 'Status', required=True, readonly=True), 'sequence_id' : fields.many2one('ir.sequence', 'Order IDs Sequence', readonly=True, @@ -121,6 +122,7 @@ class pos_config(osv.osv): 'shop_id': _default_shop, 'journal_id': _default_sale_journal, 'group_by' : True, + 'iface_invoicing': True, } def set_active(self, cr, uid, ids, context=None): diff --git a/addons/point_of_sale/point_of_sale_view.xml b/addons/point_of_sale/point_of_sale_view.xml index 8a53015b7d7..cd2d01333bd 100644 --- a/addons/point_of_sale/point_of_sale_view.xml +++ b/addons/point_of_sale/point_of_sale_view.xml @@ -790,6 +790,7 @@ + diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index ec4924c6068..4f10d10fab3 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -160,7 +160,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal ['name','journal_ids','shop_id','journal_id', 'iface_self_checkout', 'iface_led', 'iface_cashdrawer', 'iface_payment_terminal', 'iface_electronic_scale', 'iface_barscan', 'iface_vkeyboard', - 'iface_print_via_proxy','iface_cashdrawer','state','sequence_id','session_ids'], + 'iface_print_via_proxy','iface_cashdrawer','iface_invoicing','state','sequence_id','session_ids'], [['id','=', self.get('pos_session').config_id[0]]] ); }).then(function(configs){ @@ -171,6 +171,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal self.iface_vkeyboard = !!pos_config.iface_vkeyboard; self.iface_self_checkout = !!pos_config.iface_self_checkout; self.iface_cashdrawer = !!pos_config.iface_cashdrawer; + self.iface_invoicing = !!pos_config.iface_invoicing; return self.fetch('sale.shop',[],[['id','=',pos_config.shop_id[0]]]); }).then(function(shops){ diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index 6c96d51748b..651fe7bdea5 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -843,7 +843,9 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa // // But since the print dialog also blocks the other asynchronous calls, the // button enabling in the setTimeout() is blocked until the printing dialog is - // closed. But this is not reliable ... if the timeout is too slow it doesn't work + // closed. But the timeout has to be big enough or else it doesn't work + // 2 seconds is the same as the default timeout for sending orders and so the dialog + // should have appeared before the timeout... so yeah that's not ultra reliable. finish_button.set_disabled(true); setTimeout(function(){ @@ -898,7 +900,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa this.set_numpad_state(this.pos_widget.numpad.state); - this.back_button = this.add_action_button({ + this.add_action_button({ label: 'Back', icon: '/point_of_sale/static/src/img/icons/png48/go-previous.png', click: function(){ @@ -906,7 +908,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa }, }); - this.validate_button = this.add_action_button({ + this.add_action_button({ label: 'Validate', name: 'validation', icon: '/point_of_sale/static/src/img/icons/png48/validate.png', @@ -914,15 +916,17 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa self.validateCurrentOrder(); }, }); - - this.invoice_button = this.add_action_button({ - label: 'Invoice', - name: 'invoice', - icon: '/point_of_sale/static/src/img/icons/png48/invoice.png', - click: function(){ - self.validateCurrentOrder({invoice: true}); - }, - }); + + if(this.pos.iface_invoicing){ + this.add_action_button({ + label: 'Invoice', + name: 'invoice', + icon: '/point_of_sale/static/src/img/icons/png48/invoice.png', + click: function(){ + self.validateCurrentOrder({invoice: true}); + }, + }); + } this.updatePaymentSummary(); this.line_refocus();this