Openbravo Issue Tracking System - Retail Modules
View Issue Details
0028112Retail ModulesDiscounts and Promotionspublic2014-11-06 17:492014-11-16 22:17
malsasua 
marvintm 
normalminoralways
newopen 
20Community Appliance
 
 
No
No
0028112: the CalculateGross function is called several times
with old flow of discounts, the calculateGross function is run for each execution of discount per line, and it should be executed only in the last execution of discount (when the last line of receipt is processed)
in backoffice
. add preference:
  . property: WEB POS Enable New Flow Discount
  . value: N
  . visible at client: The White Valley Group
  . visible at org: *
  
in POS
. in console, add a breakpoint in the line
  evt.get('receipt').calculateGross();

. add several lines
. apply discretionary discount in all lines

for each line, calculateGross is called, and only it should be called once.
No tags attached.
Issue History
2014-11-06 17:49malsasuaNew Issue
2014-11-06 17:49malsasuaAssigned To => marvintm
2014-11-06 17:49malsasuaOBNetwork customer => No
2014-11-06 17:49malsasuaTriggers an Emergency Pack => No
2014-11-06 17:54hgbotCheckin
2014-11-06 17:54hgbotNote Added: 0071467
2014-11-06 17:54hgbotStatusnew => resolved
2014-11-06 17:54hgbotResolutionopen => fixed
2014-11-06 17:54hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/49270b838bced95716ba0194fee496fb7bfc8667 [^]
2014-11-16 22:17mtaalNote Added: 0071677
2014-11-16 22:17mtaalStatusresolved => new
2014-11-16 22:17mtaalResolutionfixed => open

Notes
(0071467)
hgbot   
2014-11-06 17:54   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 49270b838bced95716ba0194fee496fb7bfc8667
Author: Miguel A. Alsasua <miguel.alsasua <at> openbravo.com>
Date: Thu Nov 06 17:54:35 2014 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/49270b838bced95716ba0194fee496fb7bfc8667 [^]

fixed issue 28112:in the executor of discounts, calculateGross is executed when the eventQueue of executions of discount is void

---
M web/org.openbravo.retail.posterminal/js/model/executor.js
---
(0071677)
mtaal   
2014-11-16 22:17   
I checked/tested it and calculategross is still called twice when deleting a discount from a line.

When I delete a discount then also the pay button briefly shows the undiscounted amount. This seems related to the double call to calculate gross.

To reproduce:
- apply discounts to a line
- click on the line
- set a breakpoint in the calculategross method (for the ticket as a whole, so not the calculategross on line level)
- delete the discount
- see that the calculategross is called twice and that after the first call the pay button shows the total amount