[ADD]:Added Upstream Patch for point_of_sale

This commit is contained in:
Fatemi Lokhandwala 2018-07-10 17:59:10 +05:30
parent 819ccc9bf3
commit 1c0f3c438c
3 changed files with 17 additions and 9 deletions

View File

@ -215,7 +215,7 @@ var ProxyDevice = core.Class.extend(mixins.PropertiesMixin,{
var self = this;
function status(){
self.connection.rpc('/hw_proxy/status_json',{},{timeout:2500})
self.connection.rpc('/hw_proxy/status_json',{},{shadow: true, timeout:2500})
.then(function(driver_status){
self.set_connection_status('connected',driver_status);
},function(){
@ -239,7 +239,7 @@ var ProxyDevice = core.Class.extend(mixins.PropertiesMixin,{
callbacks[i](params);
}
if(this.get('status').status !== 'disconnected'){
return this.connection.rpc('/hw_proxy/' + name, params || {});
return this.connection.rpc('/hw_proxy/' + name, params || {}, {shadow: true});
}else{
return (new $.Deferred()).reject();
}
@ -588,7 +588,7 @@ var BarcodeReader = core.Class.extend({
this.remote_active = 1;
function waitforbarcode(){
return self.proxy.connection.rpc('/hw_proxy/scanner',{},{timeout:7500})
return self.proxy.connection.rpc('/hw_proxy/scanner',{},{shadow: true, timeout:7500})
.then(function(barcode){
if(!self.remote_scanning){
self.remote_active = 0;

View File

@ -259,6 +259,7 @@ exports.PosModel = Backbone.Model.extend({
// we attribute a role to the user, 'cashier' or 'manager', depending
// on the group the user belongs.
var pos_users = [];
var current_cashier = self.get_cashier();
for (var i = 0; i < users.length; i++) {
var user = users[i];
for (var j = 0; j < user.groups_id.length; j++) {
@ -276,6 +277,8 @@ exports.PosModel = Backbone.Model.extend({
// replace the current user with its updated version
if (user.id === self.user.id) {
self.user = user;
}
if (user.id === current_cashier.id) {
self.set_cashier(user);
}
}
@ -629,7 +632,7 @@ exports.PosModel = Backbone.Model.extend({
// changes the current cashier
set_cashier: function(user){
this.set('cashier', user);
this.db.set_cashier(this.cashier);
this.db.set_cashier(this.get('cashier'));
},
//creates a new empty order and sets it as the current order
add_new_order: function(){
@ -940,6 +943,7 @@ exports.PosModel = Backbone.Model.extend({
model: 'pos.order',
method: 'create_from_ui',
args: args,
kwargs: {context: session.user_context},
}, {
timeout: timeout,
shadow: !options.to_invoice
@ -1384,7 +1388,8 @@ exports.Orderline = Backbone.Model.extend({
if (unit.rounding) {
this.quantity = round_pr(quant, unit.rounding);
var decimals = this.pos.dp['Product Unit of Measure'];
this.quantityStr = field_utils.format.float(round_di(this.quantity, decimals), {digits: [69, decimals]});
this.quantity = round_di(this.quantity, decimals)
this.quantityStr = field_utils.format.float(this.quantity, {digits: [69, decimals]});
} else {
this.quantity = round_pr(quant, 1);
this.quantityStr = this.quantity.toFixed(0);
@ -1400,6 +1405,7 @@ exports.Orderline = Backbone.Model.extend({
this.set_unit_price(this.product.get_price(this.order.pricelist, this.get_quantity()));
this.order.fix_tax_included_price(this);
}
this.trigger('change', this);
},
// return the quantity of product
get_quantity: function(){
@ -2118,7 +2124,7 @@ exports.Order = Backbone.Model.extend({
company_registry: company.company_registry,
contact_address: company.partner_id[1],
vat: company.vat,
vat_label: company.country.vat_label,
vat_label: company.country && company.country.vat_label || '',
name: company.name,
phone: company.phone,
logo: this.pos.company_logo_base64,

View File

@ -1172,9 +1172,11 @@ var ClientListScreenWidget = ScreenWidget.extend({
var order = this.pos.get_order();
if( this.has_client_changed() ){
var default_fiscal_position_id = _.findWhere(this.pos.fiscal_positions, {'id': this.pos.config.default_fiscal_position_id[0]});
if ( this.new_client && this.new_client.property_account_position_id ) {
var client_fiscal_position_id = _.findWhere(this.pos.fiscal_positions, {'id': this.new_client.property_account_position_id[0]});
order.fiscal_position = client_fiscal_position_id || default_fiscal_position_id;
if ( this.new_client ) {
if (this.new_client.property_account_position_id ){
var client_fiscal_position_id = _.findWhere(this.pos.fiscal_positions, {'id': this.new_client.property_account_position_id[0]});
order.fiscal_position = client_fiscal_position_id || default_fiscal_position_id;
}
order.set_pricelist(_.findWhere(this.pos.pricelists, {'id': this.new_client.property_product_pricelist[0]}) || this.pos.default_pricelist);
} else {
order.fiscal_position = default_fiscal_position_id;