[imp] warning product not recognized

bzr revid: rlo@openerp.com-20120326122743-3m6c24j0dnb9c1yq
This commit is contained in:
Roberto López López (OpenERP)
2012-03-26 14:27:43 +02:00
parent e398d3aa12
commit 08e30b83bf
2 changed files with 20 additions and 1 deletions
+17 -1
View File
@@ -1298,10 +1298,26 @@ openerp.point_of_sale = function(db) {
price = '';
}
var scannedProductModel = _.detect(productsCollection.models, function(pc) { return pc.attributes.ean13 === barcode;});
if (scannedProductModel == undefined) {
// product not recognized, raise warning
$(QWeb.render('pos-scan-warning')).dialog({
resizable: false,
height:160,
modal: true,
title: "Warning",
buttons: {
"OK": function() {
$( this ).dialog( "close" );
},
}
});
}
if (weight === '' && price !== '') {
// product sold by price
scannedProductModel.price = price;
} else if (weight !== '' && price === '') {
// TODO sell by weight: how to calculate the price?
// product sold by weight
// TODO check how to calculate the price
scannedProductModel.price *= weight;
}
selectedOrder.addProduct(scannedProductModel);
@@ -141,6 +141,9 @@
</a>
</span>
</t>
<t t-name="pos-scan-warning">
<div>The product could not be recognized. Please contact an employee.</div>
</t>
<t t-name="pos-close-warning">
<div>There are pending operations that could not be saved into the database, are you sure you want to exit?</div>
</t>