From 3a52dbb43ac0e8fd58ec8fa09449c592131692eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Mon, 14 May 2012 16:31:21 +0200 Subject: [PATCH] [IMP] point_of_sale: Added a Session Error popup bzr revid: fva@openerp.com-20120514143121-m5tmqhwanf8tube9 --- .../static/src/js/pos_screens.js | 8 + .../static/src/js/pos_widgets.js | 25 +++- addons/point_of_sale/static/src/xml/pos.xml | 139 +++++++++++------- 3 files changed, 110 insertions(+), 62 deletions(-) diff --git a/addons/point_of_sale/static/src/js/pos_screens.js b/addons/point_of_sale/static/src/js/pos_screens.js index a9a935b4750..3b321602145 100644 --- a/addons/point_of_sale/static/src/js/pos_screens.js +++ b/addons/point_of_sale/static/src/js/pos_screens.js @@ -216,6 +216,14 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa }, }); + module.ErrorProductNotRecognizedPopupWidget = module.ErrorPopupWidget.extend({ + template:'ErrorProductNotRecognizedPopupWidget', + }); + + module.ErrorNoSessionPopupWidget = module.ErrorPopupWidget.extend({ + template:'ErrorNoSessionPopupWidget', + }); + module.ScaleInviteScreenWidget = module.ScreenWidget.extend({ template:'ScaleInviteScreenWidget', show: function(){ diff --git a/addons/point_of_sale/static/src/js/pos_widgets.js b/addons/point_of_sale/static/src/js/pos_widgets.js index 590bd646b59..5a4b413f9cc 100644 --- a/addons/point_of_sale/static/src/js/pos_widgets.js +++ b/addons/point_of_sale/static/src/js/pos_widgets.js @@ -793,15 +793,17 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa this.build_widgets(); instance.webclient.set_content_full_screen(true); - if (self.pos.get('account_journals').length === 0) { + if (!self.pos.get('account_journals') ||self.pos.get('account_journals').length === 0) { // TODO: Create a popup to inform there is no PoSSession for this user - self.pos.screen_selector.show_popup('error'); + self.screen_selector.show_popup('error-session'); } }, this)); }, build_widgets: function() { + // -------- Screens --------- + this.search_product_screen = new module.SearchProductScreenWidget(this,{ pos: this.pos, pos_widget: this, @@ -850,6 +852,8 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa }); this.scale_product_screen.appendTo($('#rightpane')); + // -------- Popups --------- + this.help_popup = new module.HelpPopupWidget(this, { pos: this.pos, pos_widget: this, @@ -868,6 +872,18 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa }); this.error_popup.appendTo($('.point-of-sale')); + this.error_product_popup = new module.ErrorProductNotRecognizedPopupWidget(this, { + pos: this.pos, + pos_widget: this, + }); + this.error_product_popup.appendTo($('.point-of-sale')); + + this.error_session_popup = new module.ErrorNoSessionPopupWidget(this, { + pos: this.pos, + pos_widget: this, + }); + this.error_session_popup.appendTo($('.point-of-sale')); + this.action_bar = new module.ActionBarWidget(this); this.action_bar.appendTo($(".point-of-sale #content")); @@ -886,9 +902,6 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa }); this.order_widget.replace($('#placeholder-OrderWidget')); - //this.orderView.$element = $('#current-order-content'); - //this.orderView.start(); - this.onscreen_keyboard = new module.OnscreenKeyboardWidget(this, { 'keyboard_model': 'simple' }); @@ -909,6 +922,8 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa popup_set:{ 'help': this.help_popup, 'error': this.error_popup, + 'error-product': this.error_product_popup, + 'error-session': this.error_session_popup, 'receipt': this.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 18b939e4a50..7aba6a12036 100644 --- a/addons/point_of_sale/static/src/xml/pos.xml +++ b/addons/point_of_sale/static/src/xml/pos.xml @@ -2,62 +2,64 @@ + -
-
-
- +
+
+
+ +
+
+ + +
+
+
+ +
    +
    +
    -
    - - -
    -
    -
    - -
      +
      + +
      +
      +
      + +
        +
      • + Subtotal: + + 0 + +
      • + +
      • + Tax: + + 0 + +
      • + +
      • + Total: + + 0 + +
      • +
      + +
      +
      + +
      +
      +
      -
      - -
      -
      -
      - -
        -
      • - Subtotal: - - 0 - -
      • - -
      • - Tax: - - 0 - -
      • - -
      • - Total: - - 0 - -
      • -
      - -
      -
      - -
      -
      -
      -
      -
      -
      +
      @@ -74,6 +76,7 @@
      + @@ -81,13 +84,16 @@ +
      There are pending operations that could not be saved into the database, are you sure you want to exit?
      +
      +
      @@ -115,8 +121,6 @@
      - -
      +
      +
      @@ -162,8 +168,6 @@
      - -

      Payment

      @@ -213,8 +217,6 @@
      - -

      Receipt

      @@ -229,7 +231,6 @@
      -
      @@ -282,6 +283,7 @@
      +