Openbravo Issue Tracking System - Retail Modules
View Issue Details
0033734Retail ModulesDiscounts and Promotionspublic2016-08-18 08:442016-09-01 16:03
aaroncalero 
jorge-garcia 
highmajoralways
closedfixed 
5
 
 
migueldejuana
No
0033734: [SERQA 1601]Total of the ticket is wrongly calculated due to the rounding of discounts
When a line in web pos has a discount applied, and this discount has been rounded up (e.g. from 3.375 to 3.38), the total of the ticket is wrongly calculated.
Login in the erp (e.g. https://livebuilds.openbravo.com/retail_pi_pgsql/ [^]), White valley group admin role, and define the following discount:
Org: *
Type: Price Adjustment
Name: Sun Cream 27%
Starting Date: 1/1/2016
Included Products: Only those defined
Discount %: 27
Leave the rest of the fields as default.

On the Products subtab, add the 'Sun cream + lip stick' product.

Login in web pos (terminal: VBS-1), create an empty ticket and add a Sun cream + lip stick. The ticket will look as follows:
One line, Sun cream + lip stick; 1 unit; 12.50 total
-- Applied discount: Sun Cream 27%, amount: -3.38 (rounded up from 3.375)

Total of the ticket: 9.13

The ticket total should have been 12.50 - 3.38 = 9.12 and it is not.
The total amount of the ticket should be calculated taking into account the rounded amounts of the discounts.
SER-QA
causes defect 0036003 closed ranjith_qualiantech_com [RR17Q2] POS breaks when several discounts are applied to same product 
png discount.png (80,501) 2016-08-18 08:50
https://issues.openbravo.com/file_download.php?file_id=9726&type=bug
png

png pos.png (76,719) 2016-08-18 08:50
https://issues.openbravo.com/file_download.php?file_id=9727&type=bug
png
Issue History
2016-08-18 08:44aaroncaleroNew Issue
2016-08-18 08:44aaroncaleroAssigned To => Retail
2016-08-18 08:44aaroncaleroTriggers an Emergency Pack => No
2016-08-18 08:48aaroncaleroResolution time => 1472680800
2016-08-18 08:48aaroncaleroSummaryTotal of the ticket is wrongly calculated due to the rounding of discounts => [SERQA 1601]Total of the ticket is wrongly calculated due to the rounding of discounts
2016-08-18 08:48aaroncaleroTag Attached: SER-QA
2016-08-18 08:50aaroncaleroFile Added: discount.png
2016-08-18 08:50aaroncaleroFile Added: pos.png
2016-08-22 14:44jorge-garciaStatusnew => scheduled
2016-08-22 14:44jorge-garciaAssigned ToRetail => jorge-garcia
2016-08-25 08:11hgbotCheckin
2016-08-25 08:11hgbotNote Added: 0089373
2016-08-25 08:11hgbotCheckin
2016-08-25 08:11hgbotNote Added: 0089374
2016-08-25 08:12hgbotCheckin
2016-08-25 08:12hgbotNote Added: 0089375
2016-08-25 08:12hgbotStatusscheduled => resolved
2016-08-25 08:12hgbotResolutionopen => fixed
2016-08-25 08:12hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/94dca5a2d2faa9390d578f061ce048616aa03514 [^]
2016-09-01 16:03migueldejuanaReview Assigned To => migueldejuana
2016-09-01 16:03migueldejuanaNote Added: 0089670
2016-09-01 16:03migueldejuanaStatusresolved => closed
2017-06-26 10:44dmitry_mezentsevRelationship addedcauses 0036003

Notes
(0089373)
hgbot   
2016-08-25 08:11   
Repository: tools/automation/pi-mobile
Changeset: dd8238652d98bc8ab13feca0d19717c7f61775df
Author: Jorge Garcia <jorge.garcia <at> openbravo.com>
Date: Wed Aug 24 14:27:36 2016 +0200
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/dd8238652d98bc8ab13feca0d19717c7f61775df [^]

Verifies issue 33734: [SERQA 1601]Total of the ticket is wrongly calculated
due to the rounding of discounts

Added test I33734_WrongTotalWithRoundedPromotions.

---
A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I33734_WrongTotalWithRoundedPromotions.java
---
(0089374)
hgbot   
2016-08-25 08:11   
Repository: erp/pmods/org.openbravo.retail.sampledata
Changeset: f662b69f78387ed726861090d4edb64d816a7179
Author: Jorge Garcia <jorge.garcia <at> openbravo.com>
Date: Wed Aug 24 14:49:13 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.sampledata/rev/f662b69f78387ed726861090d4edb64d816a7179 [^]

Related to issue 33734: [SERQA 1601]Total of the ticket is wrongly calculated
due to the rounding of discounts

New discount defined: Biby bag 27%

---
M referencedata/sampledata/The_White_Valley_Group/M_OFFER.xml
M referencedata/sampledata/The_White_Valley_Group/M_OFFER_PRODUCT.xml
---
(0089375)
hgbot   
2016-08-25 08:12   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 94dca5a2d2faa9390d578f061ce048616aa03514
Author: Jorge Garcia <jorge.garcia <at> openbravo.com>
Date: Wed Aug 24 13:40:22 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/94dca5a2d2faa9390d578f061ce048616aa03514 [^]

Fixed issue 33734: [SERQA 1601]Total of the ticket is wrongly calculated
due to the rounding of discounts

The solution is calculate the total of the receipt with the amount discounted
rounded to the scale defined in the backend for the WebPOS.

---
M web/org.openbravo.retail.posterminal/js/model/order.js
---
(0089670)
migueldejuana   
2016-09-01 16:03   
Tested and reviewed