[IMP] point_of_sale: Added a Session Error popup

bzr revid: fva@openerp.com-20120514143121-m5tmqhwanf8tube9
This commit is contained in:
Frédéric van der Essen 2012-05-14 16:31:21 +02:00
parent e4b1260ace
commit 3a52dbb43a
3 changed files with 110 additions and 62 deletions

View File

@ -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(){

View File

@ -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',

View File

@ -2,62 +2,64 @@
<!-- vim:fdl=1:
-->
<templates id="template" xml:space="preserve">
<t t-name="PosWidget">
<div class="point-of-sale">
<div id="topheader">
<div id="branding">
<img src="/point_of_sale/static/src/img/logo.png" />
<div class="point-of-sale">
<div id="topheader">
<div id="branding">
<img src="/point_of_sale/static/src/img/logo.png" />
</div>
<div id="loggedas">
<span class="placeholder-SynchNotificationWidget"></span>
<button>Close</button>
</div>
<div id="rightheader">
<div id="order-selector">
<button id="neworder-button">+</button>
<ol id="orders"></ol>
</div>
</div>
</div>
<div id="loggedas">
<span class="placeholder-SynchNotificationWidget"></span>
<button>Close</button>
</div>
<div id="rightheader">
<div id="order-selector">
<button id="neworder-button">+</button>
<ol id="orders"></ol>
<div id="content">
<div id="leftpane">
<div id="placeholder-OrderWidget"></div>
<footer>
<ul id="amounts">
<li>
Subtotal:
<t t-if="widget.currency.position === 'before'" t-esc="widget.currency.symbol"/>
<span id="subtotal">0</span>
<t t-if="widget.currency.position === 'after'" t-esc="widget.currency.symbol"/>
</li>
<li>
Tax:
<t t-if="widget.currency.position === 'before'" t-esc="widget.currency.symbol"/>
<span id="tax">0</span>
<t t-if="widget.currency.position === 'after'" t-esc="widget.currency.symbol"/>
</li>
<li>
Total:
<t t-if="widget.currency.position === 'before'" t-esc="widget.currency.symbol"/>
<span id="total">0</span>
<t t-if="widget.currency.position === 'after'" t-esc="widget.currency.symbol"/>
</li>
</ul>
<div id="placeholder-PaypadWidget"></div>
<div id="placeholder-NumpadWidget"></div>
</footer>
</div>
<div id="rightpane">
</div>
</div>
</div>
<div id="content">
<div id="leftpane">
<div id="placeholder-OrderWidget"></div>
<footer>
<ul id="amounts">
<li>
Subtotal:
<t t-if="widget.currency.position === 'before'" t-esc="widget.currency.symbol"/>
<span id="subtotal">0</span>
<t t-if="widget.currency.position === 'after'" t-esc="widget.currency.symbol"/>
</li>
<li>
Tax:
<t t-if="widget.currency.position === 'before'" t-esc="widget.currency.symbol"/>
<span id="tax">0</span>
<t t-if="widget.currency.position === 'after'" t-esc="widget.currency.symbol"/>
</li>
<li>
Total:
<t t-if="widget.currency.position === 'before'" t-esc="widget.currency.symbol"/>
<span id="total">0</span>
<t t-if="widget.currency.position === 'after'" t-esc="widget.currency.symbol"/>
</li>
</ul>
<div id="placeholder-PaypadWidget"></div>
<div id="placeholder-NumpadWidget"></div>
</footer>
</div>
<div id="rightpane">
</div>
</div>
</div>
</t>
<t t-name="OrderWidget">
<div id="current-order">
<table>
@ -74,6 +76,7 @@
</table>
</div>
</t>
<t t-name="SynchNotificationWidget">
<span>
<a t-if="widget.nbr_pending &gt; 0" href="javascript:void(0)" class="oe_pos_synch-notification-button">
@ -81,13 +84,16 @@
</a>
</span>
</t>
<t t-name="PosCloseWarning">
<div>There are pending operations that could not be saved into the database, are you sure you want to exit?</div>
</t>
<t t-name="PaypadWidget">
<div id="paypad">
</div>
</t>
<t t-name="NumpadWidget">
<div id="numpad">
<button class="input-button number-char">1</button>
@ -115,8 +121,6 @@
</div>
</t>
<!-- ************ SEARCH PRODUCT SCREEN ************ -->
<t t-name="ProductCategoriesWidget">
<header>
<ol class="breadcrumb">
@ -151,10 +155,12 @@
</ol>
</div>
</t>
<t t-name="ProductListWidget">
<ol id="products-screen-ol" class="product-list">
</ol>
</t>
<t t-name="SearchProductScreenWidget">
<div id="products-screen">
<span class="placeholder-ProductCategoriesWidget" />
@ -162,8 +168,6 @@
</div>
</t>
<!-- ************ PAYMENT SCREEN ************ -->
<t t-name="PaymentScreenWidget">
<div id="payment-screen" class="step-screen">
<header><h2>Payment</h2></header>
@ -213,8 +217,6 @@
</div>
</t> <!-- pos-payment-screen -->
<!-- ************ RECEIPT SCREEN ************ -->
<t t-name="ReceiptScreenWidget">
<div id="receipt-screen" class="step-screen" >
<header><h2>Receipt</h2></header>
@ -229,7 +231,6 @@
</div>
</div>
</t>
<t t-name="WelcomeScreenWidget">
<div class="welcome-screen step-screen">
@ -282,6 +283,7 @@
</div>
</div>
</t>
<t t-name="ReceiptPopupWidget">
<div class="modal-dialog">
<div class="popup popup-help">
@ -298,6 +300,22 @@
</div>
</t>
<t t-name="ErrorProductNotRecognizedPopupWidget">
<div class="modal-dialog">
<div class="popup popup-help">
<p class="message">The scanned product was not recognized<br /> Please wait, a cashier is on the way</p>
</div>
</div>
</t>
<t t-name="ErrorNoSessionPopupWidget">
<div class="modal-dialog">
<div class="popup popup-help">
<p class="message">Sorry, we could not create a session for this user.</p>
</div>
</div>
</t>
<t t-name="ErrorPopupWidget">
<div class="modal-dialog">
<div class="popup popup-help">
@ -332,6 +350,7 @@
</a>
</li>
</t>
<t t-name="OrderlineWidget">
<tr>
<td>
@ -384,6 +403,7 @@
<button class="select-order"><t t-esc="widget.order.get('creationDate').toString('t')"/></button>
</li>
</t>
<t t-name="PosTicket">
<div class="pos-sale-ticket">
<div class="pos-right-align"><t t-esc="new Date().toString(Date.CultureInfo.formatPatterns.shortDate + ' ' +
@ -435,6 +455,7 @@
</table>
</div>
</t>
<t t-name="ActionBarWidget">
<div class="pos-actionbar">
<div class="pos-actionbar-left-pane">
@ -469,6 +490,7 @@
</div>
</li>
</t>
<t t-name="ActionButtonWidgetWithIcon">
<li t-att-class=" 'button '+ (widget.rightalign ? 'rightalign ' : '')">
<div class='icon'>
@ -477,6 +499,7 @@
</div>
</li>
</t>
<!-- Onscreen Keyboard :
http://net.tutsplus.com/tutorials/javascript-ajax/creating-a-keyboard-with-css-and-jquery/ -->
<t t-name="OnscreenKeyboardFull">
@ -540,6 +563,7 @@
<p class="close_button">close</p>
</div>
</t>
<t t-name="OnscreenKeyboardSimple">
<div class="keyboard_frame">
<ul class="keyboard simple_keyboard">
@ -581,4 +605,5 @@
<p class="close_button">close</p>
</div>
</t>
</templates>