Openbravo Issue Tracking System - Retail Modules
View Issue Details
0036258Retail ModulesWeb POSpublic2017-06-14 13:432017-06-21 07:22
umartirena 
jorge-garcia 
urgentmajoralways
closedfixed 
5
 
RR17Q3 
mtaal
No
0036258: Qty with decimals it is not properly represented in Web POS
Qty with decimals it is not properly represented in Web POS. If the qty to add in a line in Web POS has more decimals than the price precision, if the line is added to the receipt the qty is not properly rounded
* Log into Openbravo ERP and navigate to Product window.
* Search "Avalance Transceiver" Product.
* Set as UPC/EAN '1234'.Save.
* Log into a terminal
* Open Chrome Console
* Register the following hook:

OB.UTIL.HookManager.registerHook('OBPOS_BarcodeScan', function (args, c) {
  var strScancode = args.code;
  var strStartpoint = strScancode.substring(0, 2);
  if (strStartpoint === '21' && args.code.length === 13) {
    var codeTobeSend = strScancode.substring(2, 6);
    args.code = codeTobeSend;
  }
  args.attrs.cusTwsiStrScancode = strScancode;
  OB.UTIL.HookManager.callbackExecutor(args, c);
});

* Register also the following hook:

OB.UTIL.HookManager.registerHook('OBPOS_PreAddProductToOrder', function (args, c) {
  var strStartpoint = args.attrs.cusTwsiStrScancode;
  if (strStartpoint && strStartpoint.substring(0, 2) === '21' && strStartpoint.length === 13) {
    var productPrice = OB.DEC.toBigDecimal(args.productToAdd.get('standardPrice').toString());
    var totalCost = OB.DEC.toBigDecimal(strStartpoint.substring(7, 12));
    var qty = OB.DEC.div(OB.DEC.div(totalCost, OB.DEC.toBigDecimal('100')), productPrice, 20);
    args.qtyToAdd = qty;
  }
  OB.UTIL.HookManager.callbackExecutor(args, c);
});

* In Scan Tab search by the following barcode: 2112345042506
* Notice that the Total Amount is 42.50, what is correct, but the qty is 3.5416666666666665, without any rounding (should be 3.54). Also notice that the Total Qty is 3.542
No tags attached.
png Selection_077.png (84,805) 2017-06-14 13:43
https://issues.openbravo.com/file_download.php?file_id=10854&type=bug
png
Issue History
2017-06-14 13:43umartirenaNew Issue
2017-06-14 13:43umartirenaAssigned To => Retail
2017-06-14 13:43umartirenaFile Added: Selection_077.png
2017-06-14 13:43umartirenaTriggers an Emergency Pack => No
2017-06-15 17:04jorge-garciaStatusnew => scheduled
2017-06-15 17:04jorge-garciaAssigned ToRetail => jorge-garcia
2017-06-16 08:46hgbotCheckin
2017-06-16 08:46hgbotNote Added: 0097427
2017-06-16 08:46hgbotStatusscheduled => resolved
2017-06-16 08:46hgbotResolutionopen => fixed
2017-06-16 08:46hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/8f3a4931c19e35986ed1673cd7bae1fd0f81f1f5 [^]
2017-06-21 07:22mtaalReview Assigned To => mtaal
2017-06-21 07:22mtaalNote Added: 0097539
2017-06-21 07:22mtaalStatusresolved => closed
2017-06-21 07:22mtaalFixed in Version => RR17Q3

Notes
(0097427)
hgbot   
2017-06-16 08:46   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 8f3a4931c19e35986ed1673cd7bae1fd0f81f1f5
Author: Jorge Garcia <jorge.garcia <at> openbravo.com>
Date: Thu Jun 15 17:02:12 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/8f3a4931c19e35986ed1673cd7bae1fd0f81f1f5 [^]

Fixed issue 36258: Qty with decimals it is not properly represented in Web POS

The problems only occurs in the qty of the line.

The solution is to apply the scale to the quantity of the line defined in the
qty format.

---
M web/org.openbravo.retail.posterminal/js/model/order.js
---
(0097539)
mtaal   
2017-06-21 07:22   
Reviewed