Openbravo Issue Tracking System - Retail Modules
View Issue Details
0034225Retail ModulesWeb POSpublic2016-10-17 18:362016-10-17 21:16
guilleaer 
Retail 
normalmajorrandom
newopen 
5
 
 
No
0034225: Corrupted Orders - Sum of lines is not the total gross of the order
Sometimes (not frequently) one customer who works with price including taxes but use a 0% percentage get corrupted orders where the amount of the sum of the lines is not equal to the total gross of the order.

Payments always match with the total amount of the order.

Apparently, the correct amount is given by the lines, but we are not sure of that.

After a deep research we know that this happens when a order is created, then more orders are created and paid and finally the previous order is paid.

To get more information in the customer environment we added a log which is shown when this issue happens. (you can find it in dataordersave.js file)

        _.each(this.get('lines').models, function (line) {
          var fieldValue = line.get('discountedNet');
          if (!fieldValue) {
            isFieldUndefined = true;
            return;
          }
          accum = OB.DEC.add(accum, fieldValue);
        });
        var difference = OB.DEC.sub(gross, accum);

        if (!isFieldUndefined && difference !== 0) {
          OB.error(enyo.format("%s: The sum of the net of each line plus taxes does not equal the gross: '%s', gross: %s, difference: %s", errorHeader, eventParams, gross, difference));
        }

currently we don't know why this happens but I think that it could be realated to the calculation of the receipt (calculateReceipt)

It is happening in a customer environment who run s 15Q4.2


We know that the problem happens when a order is created, then more orders are created and paid and finally the previous order is paid, but we haven't been able to reproduce that...

Maybe an automated test will help us to reproduce the problem.
- create test to reproduce the problem
- Find a relevant place in the code to add log in the customer environment to get more info about the error
No tags attached.
jpg GAL_screenshoot_Selection_511.jpg (101,859) 2016-10-17 18:36
https://issues.openbravo.com/file_download.php?file_id=9921&type=bug
jpg
Issue History
2016-10-17 18:36guilleaerNew Issue
2016-10-17 18:36guilleaerAssigned To => Retail
2016-10-17 18:36guilleaerFile Added: GAL_screenshoot_Selection_511.jpg
2016-10-17 18:36guilleaerTriggers an Emergency Pack => No
2016-10-17 21:16heccamIssue Monitored: heccam

There are no notes attached to this issue.