summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic van der Essen <fva@openerp.com / fvdessen+o@gmail.com>2014-10-08 00:18:19 +0200
committerFrédéric van der Essen <fvdessen@gmail.com>2014-11-26 12:06:24 +0100
commit78fc2ef84b01afae7e2c91fed41d6567287ff10e (patch)
tree328e85bf999391e2c508a6bc4e02617509e6bbf0
parent7b47279a5a7b6fcfb6bc3c5c2300bfc7697942ec (diff)
[IMP] point_of_sale: ability to change the current cashier with the GUI
-rw-r--r--addons/point_of_sale/static/src/css/pos.css23
-rw-r--r--addons/point_of_sale/static/src/js/screens.js2
-rw-r--r--addons/point_of_sale/static/src/js/widgets.js40
-rw-r--r--addons/point_of_sale/static/src/xml/pos.xml4
4 files changed, 51 insertions, 18 deletions
diff --git a/addons/point_of_sale/static/src/css/pos.css b/addons/point_of_sale/static/src/css/pos.css
index 455b6dd609e..e54b584ce43 100644
--- a/addons/point_of_sale/static/src/css/pos.css
+++ b/addons/point_of_sale/static/src/css/pos.css
@@ -1884,6 +1884,7 @@ td {
height: 40px;
line-height:40px;
text-align:center;
+ border-radius: 2px;
margin:3px;
margin-top:10px;
margin-right:10px;
@@ -1933,15 +1934,27 @@ td {
box-sizing: border-box;
width: 80%;
}
+.pos .popup.popup-selection .message {
+ margin-top: 0;
+}
.pos .popup.popup-selection .selection {
overflow-y: auto;
- max-height: 270px;
+ max-height: 305px;
+ font-size: 16px;
+ margin: 0 -10px;
+ width: auto;
+ line-height: 50px;
+ border-top: dashed 1px rgb(215,215,215);
}
-.pos .popup.popup-selection .selection .button {
- float: none;
- display: block;
+.pos .popup.popup-selection .selection-item {
width: auto;
- margin: 8px;
+ background: rgb(230,230,230);
+ cursor: pointer;
+ text-align: left;
+ padding: 0px 16px;
+}
+.pos .popup.popup-selection .selection-item:nth-child(even) {
+ background: rgb(247,247,247);
}
/* ********* The Webkit Scrollbar ********* */
diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js
index 831bdf3b9e3..713f5208c1a 100644
--- a/addons/point_of_sale/static/src/js/screens.js
+++ b/addons/point_of_sale/static/src/js/screens.js
@@ -417,7 +417,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
}
});
- this.$('.button.item').click(function(){
+ this.$('.selection-item').click(function(){
self.pos_widget.screen_selector.close_popup();
if (options.confirm) {
var item = self.list[parseInt($(this).data('item-index'))];
diff --git a/addons/point_of_sale/static/src/js/widgets.js b/addons/point_of_sale/static/src/js/widgets.js
index ae469060b3a..074aa16dd80 100644
--- a/addons/point_of_sale/static/src/js/widgets.js
+++ b/addons/point_of_sale/static/src/js/widgets.js
@@ -577,22 +577,42 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
init: function(parent, options){
var options = options || {};
this._super(parent,options);
- this.mode = options.mode || 'cashier';
},
set_user_mode: function(mode){
this.mode = mode;
- this.refresh();
- },
- refresh: function(){
this.renderElement();
},
- get_name: function(){
- var user;
- if(this.mode === 'cashier'){
- user = this.pos.cashier || this.pos.user;
- }else{
- user = this.pos.get_order().get_client() || this.pos.user;
+ renderElement: function(){
+ var self = this;
+ this._super();
+
+ this.$el.click(function(){
+ self.click_username();
+ });
+ },
+ click_username: function(){
+ var self = this;
+
+ var list = [];
+ for (var i = 0; i < this.pos.users.length; i++) {
+ list.push({
+ 'label':this.pos.users[i].name,
+ 'item': this.pos.users[i],
+ });
}
+
+ this.pos_widget.screen_selector.show_popup('selection',{
+ 'message': _t('Change Cashier'),
+ list: list,
+ confirm: function(cashier){
+ this.pos.cashier = cashier;
+ self.renderElement();
+ },
+ });
+
+ },
+ get_name: function(){
+ var user = this.pos.cashier || this.pos.user;
if(user){
return user.name;
}else{
diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml
index 146b8a1a9ae..3ea598ea983 100644
--- a/addons/point_of_sale/static/src/xml/pos.xml
+++ b/addons/point_of_sale/static/src/xml/pos.xml
@@ -1013,9 +1013,9 @@
<div class="modal-dialog">
<div class="popup popup-selection">
<p class="message"><t t-esc=" widget.message || 'Confirm ?' " /></p>
- <div class='selection'>
+ <div class='selection scrollable-y touch-scrollable'>
<t t-foreach="widget.list || []" t-as="item">
- <div class='button item' t-att-data-item-index='item_index'>
+ <div class='selection-item' t-att-data-item-index='item_index'>
<t t-esc='item.label'/>
</div>
</t>