Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0041887
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Retail Modules] Discounts by Totalmajoralways2019-09-26 10:092020-02-25 11:53
ReporterLeyreView Statuspublic 
Assigned Torqueralta 
PriorityhighResolutionfixedFixed in VersionRR20Q1
StatusclosedFix in branchFixed in SCM revisionb04833a67ca8
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tomarvintm
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0041887: The "By Total" discount does not apply correctly the discounted qty. on the receipt lines, since it does review other discounts

DescriptionThe "By Total" discount does not apply correctly the discounted qty. on the receipt lines, since it does review other discounts
Steps To ReproduceBackend:
Set "Web POS Use advanced discounts engine" = N

Web POS:
1. Add two lines of the same non-grouped product with price = 100:
   Line 1 - P1 100
   Line 2 - P1 100
2. Add a discount type = User Defined Amount of 40 to the first line
   Line 1 - P1 100-40=60
   Line 2 - P1 100

3. Add a discount type = Variable Discount per Total Amount of 20 to the receipt

Verify that the second discount should be applied proportionally on the lines of quantity:
   P1 60
   P1 100

But it applies without the first discount:
   P1 = 100
   P1 = 100
TagsNo tags attached.
Attached Filespng file icon test.png [^] (101,275 bytes) 2019-10-15 08:53

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0043322 closedrqueralta The "By Total" discount does not apply correctly the discounted qty. on the receipt lines 

-  Notes
(0115193)
hgbot (developer)
2019-10-21 20:33

Repository: erp/pmods/org.openbravo.retail.discounts.bytotal
Changeset: 41a4e206faede44da5800372f7501757929f4abc
Author: Rafael Queralta <rafaelcuba81 <at> gmail.com>
Date: Wed Oct 16 16:01:02 2019 -0400
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/41a4e206faede44da5800372f7501757929f4abc [^]

Fixed issue 41887: The "By Total" discount does not apply correctly the
discounted qty. on the receipt lines

- Instead of calculating the discount amount from the total price of the line,
now we calculate it from the total price minus the discounted amount of the line,
if the promitions applied are diferent of the new promotion to apply in the line.

---
M web/org.openbravo.retail.discounts.bytotal/js/promotion-by-total-utils.js
---
(0115195)
hgbot (developer)
2019-10-22 02:28

Repository: erp/pmods/org.openbravo.retail.discounts.bytotal
Changeset: c883ab2cf639105621d1af054c70eb7b8a2dc421
Author: Rafael Queralta <rafaelcuba81 <at> gmail.com>
Date: Mon Oct 21 20:27:02 2019 -0400
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/c883ab2cf639105621d1af054c70eb7b8a2dc421 [^]

Related to issue 41887: The "By Total" discount does not apply correctly the
discounted qty. on the receipt lines

Backed out changeset: 41a4e206faed

---
M web/org.openbravo.retail.discounts.bytotal/js/promotion-by-total-utils.js
---
(0115255)
hgbot (developer)
2019-10-23 19:27

Repository: erp/pmods/org.openbravo.retail.discounts.bytotal
Changeset: 798cdc80552645d077de1f3db5701e0a1ed59a08
Author: Rafael Queralta <rafaelcuba81 <at> gmail.com>
Date: Tue Oct 22 13:35:35 2019 -0400
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/798cdc80552645d077de1f3db5701e0a1ed59a08 [^]

Fixed issue 41887: The "By Total" discount does not apply correctly the
discounted qty. on the receipt lines

- Instead of calculating the discount amount from the total price of the line,
now we calculate it from the total price minus the discounted amount of the line,
if the promitions applied are diferent of the new promotion to apply in the line
and the line it is not a splited line

---
M web/org.openbravo.retail.discounts.bytotal/js/promotion-by-total-utils.js
---
(0115261)
jorge-garcia (reporter)
2019-10-24 10:27

Code is not working correctly in all cases.

1. Add two lines of the same non-grouped product with price = 100:
   Line 1 - P1 100
   Line 2 - P1 100
2. Add a discount type = User Defined Amount of 40 to the SECOND line
   Line 1 - P1 100
   Line 2 - P1 100 -40 = 60
3. Add a discount type = Variable Discount per Total Amount of 20 to the receipt

The by total discount is not being applied proportionally to the lines. It should be
   Line 1 - P1 14 from by total discount
   Line 2 - P1 6 from by total discount

And instead it is:
   Line 1 - P1 10 from by total discount (wrong)
   Line 2 - P1 10 from by total discount (wrong)
(0115285)
hgbot (developer)
2019-10-26 19:42

Repository: erp/pmods/org.openbravo.retail.discounts.bytotal
Changeset: 6e03fca44e7e75cf77dd4711df6ba3a9c49596fc
Author: Rafael Queralta <rafaelcuba81 <at> gmail.com>
Date: Fri Oct 25 13:57:49 2019 -0400
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/6e03fca44e7e75cf77dd4711df6ba3a9c49596fc [^]

Fixed issue 41887: The "By Total" discount does not apply correctly the
discounted qty. on the receipt lines

- To solve all cases related to this problem, it was required to sort the list
of preprocesses ascendingly and take into account the lists of promotions and
manualpromotions.

---
M web/org.openbravo.retail.discounts.bytotal/js/promotion-by-total-utils.js
---
(0115387)
jorge-garcia (reporter)
2019-11-04 10:13

Code reviewed and tested
(0115491)
Leyre (developer)
2019-11-11 10:15
edited on: 2019-11-11 13:16

Backend:
1. Set a discount: User Defined Amount
2. Set another discount: Variable Discount per Total Amount
3. Modify the Price on the product "Alpine Poles" = 100 and grouped Product= no

Web POS:
1. Add Alpine poles.
2. Add Alpine poles again.
3. Add the first discount (User defined amount) to the first line with amount = 40.
4. Try adding the first discount (By total) to both lines with amount = 20

Solution:
The discount must be:
Product 1 -> price 100 -> First discount = 40; Second discount = 7.5
Product 1 -> price 100 Second discount = 12.5

Possible problem:
if (index < list.length - 1) {
    discount = OB.DEC.toNumber(
      OB.DEC.toBigDecimal(linePrice).multiply(
        OB.DEC.toBigDecimal(totaldiscount).divide(
          OB.DEC.toBigDecimal(
        preprocess.totalNet || preprocess.total
          ),
          20,
          OB.DEC.getRoundingMode()
...

The total in the division must be 160 instead of 200.

(0115542)
hgbot (developer)
2019-11-11 21:57

Repository: erp/pmods/org.openbravo.retail.discounts.bytotal
Changeset: 8ed992a5708171ab948d0ab74643faf058df73d3
Author: Rafael Queralta <rafaelcuba81 <at> gmail.com>
Date: Mon Nov 11 15:52:48 2019 -0500
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/8ed992a5708171ab948d0ab74643faf058df73d3 [^]

Fixed issue 41887: The "By Total" discount does not apply correctly the
discounted qty. on the receipt lines

- Updated the divisor value, discounting the amount of the previous applied
discounts

---
M web/org.openbravo.retail.discounts.bytotal/js/promotion-by-total-utils.js
---
(0115544)
hgbot (developer)
2019-11-12 03:20

Repository: erp/pmods/org.openbravo.retail.discounts.bytotal
Changeset: 208e1806938d527014dda1e68136da799e9adf0d
Author: Rafael Queralta <rafaelcuba81 <at> gmail.com>
Date: Mon Nov 11 21:19:49 2019 -0500
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/208e1806938d527014dda1e68136da799e9adf0d [^]

Fixed issue 41887: The "By Total" discount does not apply correctly the
discounted qty. on the receipt lines

- Backed out changeset: 8ed992a57081

---
M web/org.openbravo.retail.discounts.bytotal/js/promotion-by-total-utils.js
---
(0115545)
hgbot (developer)
2019-11-12 04:59

Repository: erp/pmods/org.openbravo.retail.discounts.bytotal
Changeset: b04833a67ca82127602de9e1b5b5f37b9a442f5a
Author: Rafael Queralta <rafaelcuba81 <at> gmail.com>
Date: Mon Nov 11 22:56:45 2019 -0500
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/b04833a67ca82127602de9e1b5b5f37b9a442f5a [^]

Fixed issue 41887: The "By Total" discount does not apply correctly the
discounted qty. on the receipt lines

- Updated the divisor value, discounting the amount of the previous applied
discounts

---
M web/org.openbravo.retail.discounts.bytotal/js/promotion-by-total-utils.js
---

- Issue History
Date Modified Username Field Change
2019-09-26 10:09 Leyre New Issue
2019-09-26 10:09 Leyre Assigned To => Retail
2019-09-26 10:09 Leyre Resolution time => 1571263200
2019-09-26 10:09 Leyre Triggers an Emergency Pack => No
2019-09-27 19:24 rqueralta Assigned To Retail => rqueralta
2019-09-27 19:24 rqueralta Status new => scheduled
2019-10-15 08:53 Leyre File Added: test.png
2019-10-21 20:33 hgbot Checkin
2019-10-21 20:33 hgbot Note Added: 0115193
2019-10-21 20:33 hgbot Status scheduled => resolved
2019-10-21 20:33 hgbot Resolution open => fixed
2019-10-21 20:33 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/41a4e206faede44da5800372f7501757929f4abc [^]
2019-10-22 02:28 hgbot Checkin
2019-10-22 02:28 hgbot Note Added: 0115195
2019-10-22 15:22 marvintm Status resolved => new
2019-10-22 15:22 marvintm Resolution fixed => open
2019-10-23 19:27 hgbot Checkin
2019-10-23 19:27 hgbot Note Added: 0115255
2019-10-23 19:27 hgbot Status new => resolved
2019-10-23 19:27 hgbot Resolution open => fixed
2019-10-23 19:27 hgbot Fixed in SCM revision http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/41a4e206faede44da5800372f7501757929f4abc [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/798cdc80552645d077de1f3db5701e0a1ed59a08 [^]
2019-10-24 10:22 jorge-garcia Review Assigned To => jorge-garcia
2019-10-24 10:27 jorge-garcia Note Added: 0115261
2019-10-24 10:27 jorge-garcia Status resolved => new
2019-10-24 10:27 jorge-garcia Resolution fixed => open
2019-10-26 19:42 hgbot Checkin
2019-10-26 19:42 hgbot Note Added: 0115285
2019-10-26 19:42 hgbot Status new => resolved
2019-10-26 19:42 hgbot Resolution open => fixed
2019-10-26 19:42 hgbot Fixed in SCM revision http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/798cdc80552645d077de1f3db5701e0a1ed59a08 [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/6e03fca44e7e75cf77dd4711df6ba3a9c49596fc [^]
2019-11-04 10:13 jorge-garcia Note Added: 0115387
2019-11-04 10:13 jorge-garcia Status resolved => closed
2019-11-04 10:13 jorge-garcia Fixed in Version => RR20Q1
2019-11-11 10:15 Leyre Note Added: 0115491
2019-11-11 10:15 Leyre Status closed => new
2019-11-11 10:15 Leyre File Added: error.png
2019-11-11 10:18 Leyre Note Edited: 0115491 View Revisions
2019-11-11 13:16 Leyre Note Edited: 0115491 View Revisions
2019-11-11 13:16 Leyre File Deleted: error.png
2019-11-11 21:55 rqueralta Status new => scheduled
2019-11-11 21:57 hgbot Checkin
2019-11-11 21:57 hgbot Note Added: 0115542
2019-11-11 21:57 hgbot Status scheduled => resolved
2019-11-11 21:57 hgbot Fixed in SCM revision http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/6e03fca44e7e75cf77dd4711df6ba3a9c49596fc [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/8ed992a5708171ab948d0ab74643faf058df73d3 [^]
2019-11-12 03:20 hgbot Checkin
2019-11-12 03:20 hgbot Note Added: 0115544
2019-11-12 03:20 hgbot Fixed in SCM revision http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/8ed992a5708171ab948d0ab74643faf058df73d3 [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/208e1806938d527014dda1e68136da799e9adf0d [^]
2019-11-12 04:59 hgbot Checkin
2019-11-12 04:59 hgbot Note Added: 0115545
2019-11-12 04:59 hgbot Fixed in SCM revision http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/208e1806938d527014dda1e68136da799e9adf0d [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/b04833a67ca82127602de9e1b5b5f37b9a442f5a [^]
2019-11-14 17:47 marvintm Review Assigned To jorge-garcia => marvintm
2019-11-14 17:47 marvintm Status resolved => closed
2020-02-25 11:52 Leyre Relationship added related to 0043322
2020-02-25 11:53 Leyre Summary The "By Total" discount does not apply correctly the discounted qty. on the receipt lines => The "By Total" discount does not apply correctly the discounted qty. on the receipt lines, since it does review other discounts
2020-02-25 11:53 Leyre Description Updated View Revisions


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker