From 1af48858a5d7870e096c95246730fe7fe298b98a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Mon, 19 Nov 2012 17:09:00 +0100 Subject: [PATCH] [IMP] prompt for cashier intervention when negative or zero price in self-checkout bzr revid: fva@openerp.com-20121119160900-ks6a0bfuswlipyvu --- addons/point_of_sale/static/src/js/screens.js | 12 ++++++++++-- addons/point_of_sale/static/src/js/widgets.js | 4 ++++ addons/point_of_sale/static/src/xml/pos.xml | 8 ++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index d8e53066c1e..61c6d1cc2b8 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -430,6 +430,10 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa template:'ErrorSessionPopupWidget', }); + module.ErrorNegativePricePopupWidget = module.ErrorPopupWidget.extend({ + template:'ErrorNegativePricePopupWidget', + }); + module.ScaleInviteScreenWidget = module.ScreenWidget.extend({ template:'ScaleInviteScreenWidget', @@ -684,8 +688,12 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa console.log("CANCEL_END"); return (new $.Deferred()).resolve(); } - - this.queue.schedule(this.start); + + if(this.pos.get('selectedOrder').getDueLeft() <= 0){ + this.pos_widget.screen_selector.show_popup('error-negative-price'); + }else{ + this.queue.schedule(this.start); + } this.add_action_button({ label: 'back', diff --git a/addons/point_of_sale/static/src/js/widgets.js b/addons/point_of_sale/static/src/js/widgets.js index 4984ee5dda9..6038a74b35e 100644 --- a/addons/point_of_sale/static/src/js/widgets.js +++ b/addons/point_of_sale/static/src/js/widgets.js @@ -904,6 +904,9 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa this.choose_receipt_popup = new module.ChooseReceiptPopupWidget(this, {}); this.choose_receipt_popup.appendTo($('.point-of-sale')); + this.error_negative_price_popup = new module.ErrorNegativePricePopupWidget(this, {}); + this.error_negative_price_popup.appendTo($('.point-of-sale')); + // -------- Misc --------- this.notification = new module.SynchNotificationWidget(this,{}); @@ -963,6 +966,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa 'error': this.error_popup, 'error-product': this.error_product_popup, 'error-session': this.error_session_popup, + 'error-negative-price': this.error_negative_price_popup, 'choose-receipt': this.choose_receipt_popup, }, default_client_screen: 'welcome', diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml index cb4d90f1671..6171869cbb4 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -351,6 +351,14 @@ + + + +