[FIX] point_of_sale: remove useless spaces and fix wrong indentation
This commit is contained in:
@@ -45,8 +45,8 @@ exports.PosModel = Backbone.Model.extend({
|
||||
|
||||
this.proxy_queue = new devices.JobQueue(); // used to prevent parallels communications to the proxy
|
||||
this.db = new PosDB(); // a local database used to search trough products and categories & store pending orders
|
||||
this.debug = core.debug; //debug mode
|
||||
|
||||
this.debug = core.debug; //debug mode
|
||||
|
||||
// Business data; loaded from the server at launch
|
||||
this.company_logo = null;
|
||||
this.company_logo_base64 = '';
|
||||
@@ -68,15 +68,15 @@ exports.PosModel = Backbone.Model.extend({
|
||||
|
||||
// these dynamic attributes can be watched for change by other models or widgets
|
||||
this.set({
|
||||
'synch': { state:'connected', pending:0 },
|
||||
'synch': { state:'connected', pending:0 },
|
||||
'orders': new OrderCollection(),
|
||||
'selectedOrder': null,
|
||||
'selectedClient': null,
|
||||
'cashier': null,
|
||||
});
|
||||
|
||||
this.get('orders').bind('remove', function(order,_unused_,options){
|
||||
self.on_removed_order(order,options.index,options.reason);
|
||||
this.get('orders').bind('remove', function(order,_unused_,options){
|
||||
self.on_removed_order(order,options.index,options.reason);
|
||||
});
|
||||
|
||||
// Forward the 'client' attribute on the selected order to 'selectedClient'
|
||||
@@ -88,8 +88,8 @@ exports.PosModel = Backbone.Model.extend({
|
||||
this.bind('change:selectedOrder', update_client, this);
|
||||
|
||||
// We fetch the backend data on the server asynchronously. this is done only when the pos user interface is launched,
|
||||
// Any change on this data made on the server is thus not reflected on the point of sale until it is relaunched.
|
||||
// when all the data has loaded, we compute some stuff, and declare the Pos ready to be used.
|
||||
// Any change on this data made on the server is thus not reflected on the point of sale until it is relaunched.
|
||||
// when all the data has loaded, we compute some stuff, and declare the Pos ready to be used.
|
||||
this.ready = this.load_server_data().then(function(){
|
||||
return self.after_load_server_data();
|
||||
});
|
||||
@@ -124,7 +124,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
});
|
||||
this.proxy.autoconnect({
|
||||
force_ip: self.config.proxy_ip || undefined,
|
||||
progress: function(prog){
|
||||
progress: function(prog){
|
||||
self.chrome.loading_progress(prog);
|
||||
},
|
||||
}).then(function(){
|
||||
@@ -140,9 +140,9 @@ exports.PosModel = Backbone.Model.extend({
|
||||
// Server side model loaders. This is the list of the models that need to be loaded from
|
||||
// the server. The models are loaded one by one by this list's order. The 'loaded' callback
|
||||
// is used to store the data in the appropriate place once it has been loaded. This callback
|
||||
// can return a deferred that will pause the loading of the next module.
|
||||
// can return a deferred that will pause the loading of the next module.
|
||||
// a shared temporary dictionary is available for loaders to communicate private variables
|
||||
// used during loading such as object ids, etc.
|
||||
// used during loading such as object ids, etc.
|
||||
models: [
|
||||
{
|
||||
label: 'version',
|
||||
@@ -152,12 +152,12 @@ exports.PosModel = Backbone.Model.extend({
|
||||
});
|
||||
},
|
||||
|
||||
},{
|
||||
},{
|
||||
model: 'res.users',
|
||||
fields: ['name','company_id'],
|
||||
ids: function(self){ return [session.uid]; },
|
||||
loaded: function(self,users){ self.user = users[0]; },
|
||||
},{
|
||||
},{
|
||||
model: 'res.company',
|
||||
fields: [ 'currency_id', 'email', 'website', 'company_registry', 'vat', 'name', 'phone', 'partner_id' , 'country_id', 'tax_calculation_rounding_method'],
|
||||
ids: function(self){ return [self.user.company_id[0]]; },
|
||||
@@ -171,7 +171,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
self.dp[dps[i].name] = dps[i].digits;
|
||||
}
|
||||
},
|
||||
},{
|
||||
},{
|
||||
model: 'product.uom',
|
||||
fields: [],
|
||||
domain: null,
|
||||
@@ -187,7 +187,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
fields: ['name','street','city','state_id','country_id','vat',
|
||||
'phone','zip','mobile','email','barcode','write_date',
|
||||
'property_account_position_id','property_product_pricelist'],
|
||||
domain: [['customer','=',true]],
|
||||
domain: [['customer','=',true]],
|
||||
loaded: function(self,partners){
|
||||
self.partners = partners;
|
||||
self.db.add_partners(partners);
|
||||
@@ -225,7 +225,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
fields: ['id', 'journal_ids','name','user_id','config_id','start_at','stop_at','sequence_number','login_number'],
|
||||
domain: function(self){ return [['state','=','opened'],['user_id','=',session.uid]]; },
|
||||
loaded: function(self,pos_sessions){
|
||||
self.pos_session = pos_sessions[0];
|
||||
self.pos_session = pos_sessions[0];
|
||||
},
|
||||
},{
|
||||
model: 'pos.config',
|
||||
@@ -233,7 +233,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
domain: function(self){ return [['id','=', self.pos_session.config_id[0]]]; },
|
||||
loaded: function(self,configs){
|
||||
self.config = configs[0];
|
||||
self.config.use_proxy = self.config.iface_payment_terminal ||
|
||||
self.config.use_proxy = self.config.iface_payment_terminal ||
|
||||
self.config.iface_electronic_scale ||
|
||||
self.config.iface_print_via_proxy ||
|
||||
self.config.iface_scan_via_proxy ||
|
||||
@@ -255,9 +255,9 @@ exports.PosModel = Backbone.Model.extend({
|
||||
model: 'res.users',
|
||||
fields: ['name','pos_security_pin','groups_id','barcode'],
|
||||
domain: function(self){ return [['company_id','=',self.user.company_id[0]],'|', ['groups_id','=', self.config.group_pos_manager_id[0]],['groups_id','=', self.config.group_pos_user_id[0]]]; },
|
||||
loaded: function(self,users){
|
||||
loaded: function(self,users){
|
||||
// we attribute a role to the user, 'cashier' or 'manager', depending
|
||||
// on the group the user belongs.
|
||||
// on the group the user belongs.
|
||||
var pos_users = [];
|
||||
for (var i = 0; i < users.length; i++) {
|
||||
var user = users[i];
|
||||
@@ -278,7 +278,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
self.user = user;
|
||||
}
|
||||
}
|
||||
self.users = pos_users;
|
||||
self.users = pos_users;
|
||||
},
|
||||
},{
|
||||
model: 'stock.location',
|
||||
@@ -377,7 +377,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
var i;
|
||||
self.journals = journals;
|
||||
|
||||
// associate the bank statements with their journals.
|
||||
// associate the bank statements with their journals.
|
||||
var cashregisters = self.cashregisters;
|
||||
var ilen = cashregisters.length;
|
||||
for(i = 0; i < ilen; i++){
|
||||
@@ -393,15 +393,15 @@ exports.PosModel = Backbone.Model.extend({
|
||||
self.cashregisters_by_id[self.cashregisters[i].id] = self.cashregisters[i];
|
||||
}
|
||||
|
||||
self.cashregisters = self.cashregisters.sort(function(a,b){
|
||||
// prefer cashregisters to be first in the list
|
||||
if (a.journal.type == "cash" && b.journal.type != "cash") {
|
||||
return -1;
|
||||
} else if (a.journal.type != "cash" && b.journal.type == "cash") {
|
||||
return 1;
|
||||
} else {
|
||||
self.cashregisters = self.cashregisters.sort(function(a,b){
|
||||
// prefer cashregisters to be first in the list
|
||||
if (a.journal.type == "cash" && b.journal.type != "cash") {
|
||||
return -1;
|
||||
} else if (a.journal.type != "cash" && b.journal.type == "cash") {
|
||||
return 1;
|
||||
} else {
|
||||
return a.journal.sequence - b.journal.sequence;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
@@ -445,7 +445,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
var fonts_loaded = new $.Deferred();
|
||||
// Waiting for fonts to be loaded to prevent receipt printing
|
||||
// from printing empty receipt while loading Inconsolata
|
||||
// ( The font used for the receipt )
|
||||
// ( The font used for the receipt )
|
||||
waitForWebfonts(['Lato','Inconsolata'], function(){
|
||||
fonts_loaded.resolve();
|
||||
});
|
||||
@@ -502,7 +502,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
}
|
||||
],
|
||||
|
||||
// loads all the needed data on the sever. returns a deferred indicating when all the data has loaded.
|
||||
// loads all the needed data on the sever. returns a deferred indicating when all the data has loaded.
|
||||
load_server_data: function(){
|
||||
var self = this;
|
||||
var loaded = new $.Deferred();
|
||||
@@ -525,7 +525,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
|
||||
var fields = typeof model.fields === 'function' ? model.fields(self,tmp) : model.fields;
|
||||
var domain = typeof model.domain === 'function' ? model.domain(self,tmp) : model.domain;
|
||||
var context = typeof model.context === 'function' ? model.context(self,tmp) : model.context;
|
||||
var context = typeof model.context === 'function' ? model.context(self,tmp) : model.context;
|
||||
var ids = typeof model.ids === 'function' ? model.ids(self,tmp) : model.ids;
|
||||
var order = typeof model.order === 'function' ? model.order(self,tmp): model.order;
|
||||
progress += progress_step;
|
||||
@@ -614,7 +614,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
// when we intentionally remove an unfinished order, and there is another existing one
|
||||
this.set_order(order_list[index] || order_list[order_list.length -1]);
|
||||
}else{
|
||||
// when the order was automatically removed after completion,
|
||||
// when the order was automatically removed after completion,
|
||||
// or when we intentionally delete the only concurrent order
|
||||
this.add_new_order();
|
||||
}
|
||||
@@ -639,7 +639,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
load_orders: function(){
|
||||
var jsons = this.db.get_unpaid_orders();
|
||||
var orders = [];
|
||||
var not_loaded_count = 0;
|
||||
var not_loaded_count = 0;
|
||||
|
||||
for (var i = 0; i < jsons.length; i++) {
|
||||
var json = jsons[i];
|
||||
@@ -656,7 +656,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
if (not_loaded_count) {
|
||||
console.info('There are '+not_loaded_count+' locally saved unpaid orders belonging to another session');
|
||||
}
|
||||
|
||||
|
||||
orders = orders.sort(function(a,b){
|
||||
return a.sequence_number - b.sequence_number;
|
||||
});
|
||||
@@ -668,7 +668,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
|
||||
set_start_order: function(){
|
||||
var orders = this.get('orders').models;
|
||||
|
||||
|
||||
if (orders.length && !this.get('selectedOrder')) {
|
||||
this.set('selectedOrder',orders[0]);
|
||||
} else {
|
||||
@@ -693,7 +693,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
set_order: function(order){
|
||||
this.set({ selectedOrder: order });
|
||||
},
|
||||
|
||||
|
||||
// return the list of unpaid orders
|
||||
get_order_list: function(){
|
||||
return this.get('orders').models;
|
||||
@@ -711,21 +711,21 @@ exports.PosModel = Backbone.Model.extend({
|
||||
var deferred = new $.Deferred();
|
||||
var img = new Image();
|
||||
|
||||
img.onload = function () {
|
||||
var canvas = document.createElement('CANVAS');
|
||||
var ctx = canvas.getContext('2d');
|
||||
img.onload = function () {
|
||||
var canvas = document.createElement('CANVAS');
|
||||
var ctx = canvas.getContext('2d');
|
||||
|
||||
canvas.height = this.height;
|
||||
canvas.width = this.width;
|
||||
ctx.drawImage(this,0,0);
|
||||
canvas.height = this.height;
|
||||
canvas.width = this.width;
|
||||
ctx.drawImage(this,0,0);
|
||||
|
||||
var dataURL = canvas.toDataURL('image/jpeg');
|
||||
product.image_base64 = dataURL;
|
||||
canvas = null;
|
||||
canvas = null;
|
||||
|
||||
deferred.resolve();
|
||||
};
|
||||
img.src = url;
|
||||
};
|
||||
img.src = url;
|
||||
|
||||
return deferred;
|
||||
},
|
||||
@@ -801,7 +801,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
});
|
||||
},
|
||||
|
||||
// saves the order locally and try to send it to the backend.
|
||||
// saves the order locally and try to send it to the backend.
|
||||
// it returns a deferred that succeeds after having tried to send the order and all the other pending orders.
|
||||
push_order: function(order, opts) {
|
||||
opts = opts || {};
|
||||
@@ -810,7 +810,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
if(order){
|
||||
this.db.add_order(order.export_as_JSON());
|
||||
}
|
||||
|
||||
|
||||
var pushed = new $.Deferred();
|
||||
|
||||
this.flush_mutex.exec(function(){
|
||||
@@ -831,11 +831,11 @@ exports.PosModel = Backbone.Model.extend({
|
||||
// error-no-client: the order must have an associated partner_id. You can retry to make an invoice once
|
||||
// this error is solved
|
||||
// error-transfer: there was a connection error during the transfer. You can retry to make the invoice once
|
||||
// the network connection is up
|
||||
// the network connection is up
|
||||
|
||||
push_and_invoice_order: function(order){
|
||||
var self = this;
|
||||
var invoiced = new $.Deferred();
|
||||
var invoiced = new $.Deferred();
|
||||
|
||||
if(!order.get_client()){
|
||||
invoiced.reject({code:400, message:'Missing Customer', data:{}});
|
||||
@@ -855,17 +855,17 @@ exports.PosModel = Backbone.Model.extend({
|
||||
// so we must make sure the server detects and ignores duplicated orders
|
||||
|
||||
var transfer = self._flush_orders([self.db.get_order(order_id)], {timeout:30000, to_invoice:true});
|
||||
|
||||
|
||||
transfer.fail(function(error){
|
||||
invoiced.reject(error);
|
||||
done.reject();
|
||||
});
|
||||
|
||||
// on success, get the order id generated by the server
|
||||
transfer.pipe(function(order_server_id){
|
||||
transfer.pipe(function(order_server_id){
|
||||
|
||||
// generate the pdf and download it
|
||||
self.chrome.do_action('point_of_sale.pos_invoice_report',{additional_context:{
|
||||
self.chrome.do_action('point_of_sale.pos_invoice_report',{additional_context:{
|
||||
active_ids:order_server_id,
|
||||
}});
|
||||
|
||||
@@ -915,7 +915,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
result.resolve([]);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
options = options || {};
|
||||
|
||||
var self = this;
|
||||
@@ -967,7 +967,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
},
|
||||
|
||||
scan_product: function(parsed_code){
|
||||
var selectedOrder = this.get_order();
|
||||
var selectedOrder = this.get_order();
|
||||
var product = this.db.get_product_by_barcode(parsed_code.base_code);
|
||||
|
||||
if(!product){
|
||||
@@ -997,7 +997,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
},null,2);
|
||||
},
|
||||
|
||||
// Exports the unpaid orders (the tabs)
|
||||
// Exports the unpaid orders (the tabs)
|
||||
export_unpaid_orders: function() {
|
||||
return JSON.stringify({
|
||||
'unpaid_orders': this.db.get_unpaid_orders(),
|
||||
@@ -1033,7 +1033,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
}
|
||||
report.paid = json.paid_orders.length;
|
||||
this.push_order();
|
||||
}
|
||||
}
|
||||
|
||||
if (json.unpaid_orders) {
|
||||
|
||||
@@ -1041,7 +1041,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
var existing = this.get_order_list();
|
||||
var existing_uids = {};
|
||||
var skipped_sessions = {};
|
||||
|
||||
|
||||
for (var i = 0; i < existing.length; i++) {
|
||||
existing_uids[existing[i].uid] = true;
|
||||
}
|
||||
@@ -1058,7 +1058,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
pos: this,
|
||||
json: order,
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
orders = orders.sort(function(a,b){
|
||||
@@ -1079,7 +1079,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
_load_orders: function(){
|
||||
var jsons = this.db.get_unpaid_orders();
|
||||
var orders = [];
|
||||
var not_loaded_count = 0;
|
||||
var not_loaded_count = 0;
|
||||
|
||||
for (var i = 0; i < jsons.length; i++) {
|
||||
var json = jsons[i];
|
||||
@@ -1096,7 +1096,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
if (not_loaded_count) {
|
||||
console.info('There are '+not_loaded_count+' locally saved unpaid orders belonging to another session');
|
||||
}
|
||||
|
||||
|
||||
orders = orders.sort(function(a,b){
|
||||
return a.sequence_number - b.sequence_number;
|
||||
});
|
||||
@@ -1105,7 +1105,7 @@ exports.PosModel = Backbone.Model.extend({
|
||||
this.get('orders').add(orders);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
});
|
||||
|
||||
// Add fields to the list of read fields when a model is loaded
|
||||
@@ -1363,8 +1363,8 @@ exports.Orderline = Backbone.Model.extend({
|
||||
get_product_type: function(){
|
||||
return this.type;
|
||||
},
|
||||
// sets the quantity of the product. The quantity will be rounded according to the
|
||||
// product's unity of measure properties. Quantities greater than zero will not get
|
||||
// sets the quantity of the product. The quantity will be rounded according to the
|
||||
// product's unity of measure properties. Quantities greater than zero will not get
|
||||
// rounded to zero
|
||||
set_quantity: function(quantity, keep_price){
|
||||
this.order.assert_editable();
|
||||
@@ -1486,7 +1486,7 @@ exports.Orderline = Backbone.Model.extend({
|
||||
return false;
|
||||
}else if(this.product.tracking == 'lot') {
|
||||
return false;
|
||||
}else{
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
},
|
||||
@@ -1895,7 +1895,7 @@ exports.Order = Backbone.Model.extend({
|
||||
options = options || {};
|
||||
|
||||
this.init_locked = true;
|
||||
this.pos = options.pos;
|
||||
this.pos = options.pos;
|
||||
this.selected_orderline = undefined;
|
||||
this.selected_paymentline = undefined;
|
||||
this.screen_data = {}; // see Gui
|
||||
@@ -1903,7 +1903,7 @@ exports.Order = Backbone.Model.extend({
|
||||
this.creation_date = new Date();
|
||||
this.to_invoice = false;
|
||||
this.orderlines = new OrderlineCollection();
|
||||
this.paymentlines = new PaymentlineCollection();
|
||||
this.paymentlines = new PaymentlineCollection();
|
||||
this.pos_session_id = this.pos.pos_session.id;
|
||||
this.finalized = false; // if true, cannot be modified.
|
||||
this.set_pricelist(this.pos.default_pricelist);
|
||||
@@ -1947,7 +1947,7 @@ exports.Order = Backbone.Model.extend({
|
||||
save_to_db: function(){
|
||||
if (!this.temporary && !this.init_locked) {
|
||||
this.pos.db.save_unpaid_order(this);
|
||||
}
|
||||
}
|
||||
},
|
||||
init_from_JSON: function(json) {
|
||||
var client;
|
||||
@@ -2067,7 +2067,7 @@ exports.Order = Backbone.Model.extend({
|
||||
qweb.debug = core.debug;
|
||||
qweb.default_dict = _.clone(QWeb.default_dict);
|
||||
qweb.add_template('<templates><t t-name="subreceipt">'+subreceipt+'</t></templates>');
|
||||
|
||||
|
||||
return qweb.render('subreceipt',{'pos':self.pos,'widget':self.pos.chrome,'order':self, 'receipt': receipt}) ;
|
||||
}
|
||||
}
|
||||
@@ -2092,21 +2092,21 @@ exports.Order = Backbone.Model.extend({
|
||||
money: 2,
|
||||
quantity: 3,
|
||||
},
|
||||
date: {
|
||||
year: date.getFullYear(),
|
||||
month: date.getMonth(),
|
||||
date: date.getDate(), // day of the month
|
||||
day: date.getDay(), // day of the week
|
||||
hour: date.getHours(),
|
||||
date: {
|
||||
year: date.getFullYear(),
|
||||
month: date.getMonth(),
|
||||
date: date.getDate(), // day of the month
|
||||
day: date.getDay(), // day of the week
|
||||
hour: date.getHours(),
|
||||
minute: date.getMinutes() ,
|
||||
isostring: date.toISOString(),
|
||||
localestring: date.toLocaleString(),
|
||||
},
|
||||
},
|
||||
company:{
|
||||
email: company.email,
|
||||
website: company.website,
|
||||
company_registry: company.company_registry,
|
||||
contact_address: company.partner_id[1],
|
||||
contact_address: company.partner_id[1],
|
||||
vat: company.vat,
|
||||
name: company.name,
|
||||
phone: company.phone,
|
||||
@@ -2117,7 +2117,7 @@ exports.Order = Backbone.Model.extend({
|
||||
},
|
||||
currency: this.pos.currency,
|
||||
};
|
||||
|
||||
|
||||
if (is_xml(this.pos.config.receipt_header)){
|
||||
receipt.header = '';
|
||||
receipt.header_xml = render_xml(this.pos.config.receipt_header);
|
||||
@@ -2140,7 +2140,7 @@ exports.Order = Backbone.Model.extend({
|
||||
generate_unique_id: function() {
|
||||
// Generates a public identification number for the order.
|
||||
// The generated number must be unique and sequential. They are made 12 digit long
|
||||
// to fit into EAN-13 barcodes, should it be needed
|
||||
// to fit into EAN-13 barcodes, should it be needed
|
||||
|
||||
function zero_pad(num,size){
|
||||
var s = ""+num;
|
||||
@@ -2212,7 +2212,7 @@ exports.Order = Backbone.Model.extend({
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
if (lines[i].get_product() === tip_product) {
|
||||
lines[i].set_unit_price(tip);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.add_product(tip_product, {quantity: 1, price: tip });
|
||||
@@ -2280,7 +2280,7 @@ exports.Order = Backbone.Model.extend({
|
||||
}
|
||||
|
||||
if(options.extras !== undefined){
|
||||
for (var prop in options.extras) {
|
||||
for (var prop in options.extras) {
|
||||
line[prop] = options.extras[prop];
|
||||
}
|
||||
}
|
||||
@@ -2424,7 +2424,7 @@ exports.Order = Backbone.Model.extend({
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
for(var id in details){
|
||||
if(details.hasOwnProperty(id)){
|
||||
fulldetails.push({amount: details[id], tax: this.pos.taxes_by_id[id], name: this.pos.taxes_by_id[id].name});
|
||||
@@ -2433,7 +2433,7 @@ exports.Order = Backbone.Model.extend({
|
||||
|
||||
return fulldetails;
|
||||
},
|
||||
// Returns a total only for the orderlines with products belonging to the category
|
||||
// Returns a total only for the orderlines with products belonging to the category
|
||||
get_total_for_category_with_tax: function(categ_id){
|
||||
var total = 0;
|
||||
var self = this;
|
||||
@@ -2444,7 +2444,7 @@ exports.Order = Backbone.Model.extend({
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
|
||||
this.orderlines.each(function(line){
|
||||
if ( self.pos.db.category_contains(categ_id,line.product.id) ) {
|
||||
total += line.get_price_with_tax();
|
||||
@@ -2482,7 +2482,7 @@ exports.Order = Backbone.Model.extend({
|
||||
if (!paymentline) {
|
||||
var change = this.get_total_paid() - this.get_total_with_tax();
|
||||
} else {
|
||||
var change = -this.get_total_with_tax();
|
||||
var change = -this.get_total_with_tax();
|
||||
var lines = this.paymentlines.models;
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
change += lines[i].get_amount();
|
||||
@@ -2612,7 +2612,7 @@ exports.NumpadState = Backbone.Model.extend({
|
||||
var oldBuffer;
|
||||
oldBuffer = this.get('buffer');
|
||||
this.set({
|
||||
buffer: oldBuffer[0] === '-' ? oldBuffer.substr(1) : "-" + oldBuffer
|
||||
buffer: oldBuffer[0] === '-' ? oldBuffer.substr(1) : "-" + oldBuffer
|
||||
});
|
||||
this.trigger('set_value',this.get('buffer'));
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user