[IMP] point_of_sale: ability to change the current cashier with the GUI
This commit is contained in:
committed by
Frédéric van der Essen
parent
7b47279a5a
commit
78fc2ef84b
@@ -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;
|
||||
}
|
||||
.pos .popup.popup-selection .selection .button {
|
||||
float: none;
|
||||
display: block;
|
||||
max-height: 305px;
|
||||
font-size: 16px;
|
||||
margin: 0 -10px;
|
||||
width: auto;
|
||||
margin: 8px;
|
||||
line-height: 50px;
|
||||
border-top: dashed 1px rgb(215,215,215);
|
||||
}
|
||||
.pos .popup.popup-selection .selection-item {
|
||||
width: auto;
|
||||
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 ********* */
|
||||
|
||||
@@ -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'))];
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user