Openbravo Issue Tracking System - Retail Modules
View Issue Details
0039536Retail ModulesDiscounts and Promotionspublic2018-10-25 14:022018-12-27 13:58
inaki_garcia 
ranjith_qualiantech_com 
normalmajoralways
closedfixed 
5
main 
RR19Q1 
marvintm
Packaging and release
2018-01-12
main
https://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/edd903ba2305#l8.75 [^]
No
0039536: [RR18Q4] Total Amount discounts get removed when splitting lines
A ticket with a Total Amount type discount applied, which shows on all lines, gets removed when using the Split Lines feature. Said discount cannot be reapplied again unless
the ticket is removed.

Further observations after the steps to reproduce are executed:

- Adding a product which requires providing extra contact info ("Item Declaration" popup appears) throws the following error and makes the POS unusable (check the attached "2018-10-11 13-33-09.png"
screenshot and the following error log message). 'Contact customer info for product' module is required to be installed and the 'WEB POS Show BusinessPartner Birth Information' set to 'Y' to execute this step:

Uncaught TypeError: discountRule.set is not a function
    at 2de4b76c91e46e250b8a916b152d94d1.js:3516
    at Array.forEach (<anonymous>)
    at Function.b.each.b.forEach (underscore-1.3.3.min.js:11)
    at Object.manualByTotalPromotionsExecutor (2de4b76c91e46e250b8a916b152d94d1.js:3516)
    at Object.implementation (2de4b76c91e46e250b8a916b152d94d1.js:3516)
    at G.d.applyRule (2de4b76c91e46e250b8a916b152d94d1.js:1915)
    at G.d.nextAction (2de4b76c91e46e250b8a916b152d94d1.js:1903)
    at G.d.<anonymous> (2de4b76c91e46e250b8a916b152d94d1.js:1903)
    at g.Model.trigger (backbone-0.9.2.min.js:9)
    at 2de4b76c91e46e250b8a916b152d94d1.js:1912


- If another type of discount is applied (such as "Fixed Percentage Disount" type discount) for one or more lines, the Total Amount discount reappears only for that/those line(s) (check the attached "Screenshot from 2018-10-25 14-08-11.png" screenshot)
Precondition: the "Discount rules for Retail by total" module is required to be installed and a Total Amount type discount configured.

Use this test case in as a guide to configure a Total Amount discount:

https://testlink.openbravo.com/testlink/linkto.php?tprojectPrefix=Communit&item=testcase&id=Communit-10507 [^]

0. Log into the WebPOS
1. Add some products to the ticket to insert several lines and quantities
2. Open the "Receipt disounts" popup by selecting it from the dropdown menu
3. Apply the previously created Total Amount to the ticket by selecting it and clicking on "Apply"
4. Select a line with Quantity greater than 1, and click on the "Split" option from the right pane
5. Click "Apply" on the "Split" popup
6. NOTICE that the applied discount has dissappeared from all lines

Steps are reproduced in the attached video
No tags attached.
related to defect 0039858 closed ranjith_qualiantech_com If a line with manual discounts is split, automatic discounts no longer work 
related to defect 0040007 closed ranjith_qualiantech_com Receipt with discounts can not be completed 
? ScreenRecording 2018-10-25 at 13.01.54.avi (1,777,754) 2018-10-25 14:04
https://issues.openbravo.com/file_download.php?file_id=12321&type=bug
png 2018-10-11 13-33-09.png (225,087) 2018-10-25 14:06
https://issues.openbravo.com/file_download.php?file_id=12322&type=bug
png

png Screenshot from 2018-10-25 14-08-11.png (171,589) 2018-10-25 14:08
https://issues.openbravo.com/file_download.php?file_id=12323&type=bug
png
Issue History
2018-10-25 14:02inaki_garciaNew Issue
2018-10-25 14:02inaki_garciaAssigned To => Retail
2018-10-25 14:02inaki_garciaTriggers an Emergency Pack => No
2018-10-25 14:04inaki_garciaFile Added: ScreenRecording 2018-10-25 at 13.01.54.avi
2018-10-25 14:06inaki_garciaFile Added: 2018-10-11 13-33-09.png
2018-10-25 14:08inaki_garciaFile Added: Screenshot from 2018-10-25 14-08-11.png
2018-10-25 14:09inaki_garciaDescription Updatedbug_revision_view_page.php?rev_id=17857#r17857
2018-10-25 14:10inaki_garciaDescription Updatedbug_revision_view_page.php?rev_id=17858#r17858
2018-10-25 14:11inaki_garciaDescription Updatedbug_revision_view_page.php?rev_id=17859#r17859
2018-11-23 11:03ranjith_qualiantech_comAssigned ToRetail => ranjith_qualiantech_com
2018-11-23 11:04ranjith_qualiantech_comStatusnew => scheduled
2018-12-06 14:22ranjith_qualiantech_comRegression level => Packaging and release
2018-12-06 14:22ranjith_qualiantech_comRegression date => 2018-01-12
2018-12-06 14:22ranjith_qualiantech_comRegression introduced in release => main
2018-12-06 14:22ranjith_qualiantech_comRegression introduced by commit => https://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/edd903ba2305#l8.75 [^]
2018-12-06 14:22hgbotCheckin
2018-12-06 14:22hgbotNote Added: 0108318
2018-12-07 04:14hgbotCheckin
2018-12-07 04:14hgbotNote Added: 0108320
2018-12-07 04:36ranjith_qualiantech_comRegression levelPackaging and release =>
2018-12-07 04:36ranjith_qualiantech_comRegression date2018-01-12 =>
2018-12-07 04:36ranjith_qualiantech_comRegression introduced in releasemain =>
2018-12-07 04:36ranjith_qualiantech_comRegression introduced by commithttps://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/edd903ba2305#l8.75 [^] =>
2018-12-17 07:03hgbotCheckin
2018-12-17 07:03hgbotNote Added: 0108627
2018-12-17 09:08hgbotCheckin
2018-12-17 09:08hgbotNote Added: 0108628
2018-12-17 09:08hgbotCheckin
2018-12-17 09:08hgbotNote Added: 0108629
2018-12-17 10:29ranjith_qualiantech_comRegression level => Packaging and release
2018-12-17 10:29ranjith_qualiantech_comRegression date => 2018-01-12
2018-12-17 10:29ranjith_qualiantech_comRegression introduced in release => main
2018-12-17 10:29ranjith_qualiantech_comRegression introduced by commit => https://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/edd903ba2305#l8.75 [^]
2018-12-17 10:29ranjith_qualiantech_comNote Added: 0108631
2018-12-17 10:29ranjith_qualiantech_comStatusscheduled => resolved
2018-12-17 10:29ranjith_qualiantech_comResolutionopen => fixed
2018-12-24 09:46marvintmNote Added: 0108727
2018-12-24 09:46marvintmStatusresolved => new
2018-12-24 09:46marvintmResolutionfixed => open
2018-12-26 08:37ranjith_qualiantech_comStatusnew => scheduled
2018-12-27 13:55marvintmStatusscheduled => resolved
2018-12-27 13:55marvintmFixed in Version => RR19Q1
2018-12-27 13:55marvintmResolutionopen => fixed
2018-12-27 13:56marvintmReview Assigned To => marvintm
2018-12-27 13:56marvintmNote Added: 0108768
2018-12-27 13:56marvintmStatusresolved => closed
2018-12-27 13:58marvintmRelationship addedrelated to 0039858
2019-01-28 07:22ranjith_qualiantech_comRelationship addedrelated to 0040007

Notes
(0108318)
hgbot   
2018-12-06 14:22   
Repository: erp/pmods/org.openbravo.retail.discounts.bytotal
Changeset: acc28bc9b14186d976bacb2800869861099e9483
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Thu Dec 06 18:52:12 2018 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/acc28bc9b14186d976bacb2800869861099e9483 [^]

Related to issue 39536 : Modified Discount Per Total Amount calculation

* Removed unnecessary attribute 'qtyOffer' for Disccount Per Total Amount calculation

---
M web/org.openbravo.retail.discounts.bytotal/js/promotion-by-total-utils.js
---
(0108320)
hgbot   
2018-12-07 04:14   
Repository: erp/pmods/org.openbravo.retail.discounts.bytotal
Changeset: 8cc9dda150f603fc151aa86a7fd8fd143ed5e740
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Fri Dec 07 08:44:18 2018 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/8cc9dda150f603fc151aa86a7fd8fd143ed5e740 [^]

Related to issue 39536 : Backed out changeset: acc28bc9b141

---
M web/org.openbravo.retail.discounts.bytotal/js/promotion-by-total-utils.js
---
(0108627)
hgbot   
2018-12-17 07:03   
Repository: erp/pmods/org.openbravo.retail.discounts.bytotal
Changeset: 8f683d71795f20e926385aa588570c0342142db4
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Mon Dec 17 11:33:18 2018 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts.bytotal/rev/8f683d71795f20e926385aa588570c0342142db4 [^]

Related to issue 39536 : Total Discounts must be applied to lines when spliting it

* Discount attribute 'qtyOffer' was set to 0 to support Multi Discount.
  Same attribute was used in applying discount while spliting the lines.
  So new attrbiute 'pendingQtyOffer' added to discountRule which is used in applying discounts while spliting lines

---
M web/org.openbravo.retail.discounts.bytotal/js/promotion-by-total-utils.js
---
(0108628)
hgbot   
2018-12-17 09:08   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: f8aece110f2c41b624c6d6139b69ce6ce3d2eaf5
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Mon Dec 17 13:38:14 2018 +0530
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/f8aece110f2c41b624c6d6139b69ce6ce3d2eaf5 [^]

Related to issue 39536 : Discounts must be splited proportionally to lines when splitting it

* For Mutli Discounts functionality, discountRule attribute 'qtyOffer' can be zero.
  To split the discounts, new discountRule attribute 'pendingQtyOffer' must be used for spliitng discounts.

---
M web/org.openbravo.retail.posterminal/js/model/order.js
---
(0108629)
hgbot   
2018-12-17 09:08   
Repository: tools/automation/pi-mobile
Changeset: aa9f3edc74d33b3d30dd2a20b555b55c3d10fae6
Author: Ranjith S R <ranjith <at> qualiantech.com>
Date: Mon Dec 17 13:37:59 2018 +0530
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/aa9f3edc74d33b3d30dd2a20b555b55c3d10fae6 [^]

Verifies issue 39536 : Added Test 'I39536_VerifyTotalDiscountWithSplitLines'

---
M src-test/org/openbravo/test/mobile/retail/extmodules/selenium/TestIdExtModules.java
A src-test/org/openbravo/test/mobile/retail/extmodules/selenium/tests/discounts_bytotal/I39536_VerifyTotalDiscountWithSplitLines.java
---
(0108631)
ranjith_qualiantech_com   
2018-12-17 10:29   
Regression introduced due to Muti Discounts Logic. Discount Rule attribute "qtyOffer" has been set as zero for Multi Discount support, but it was used in Split Lines functionality
(0108727)
marvintm   
2018-12-24 09:46   
Main case is now working fine. However, I still see a problem in products which have an automatic discount applied:
- Add 6 units of "Bottle 1L". This will automatically add two discounts of 3x2 Bottles
- Add manual discount "Fixed percentage discount by total 23%"
- Select the line and split it in two lines. The 23% discount will disappear
(0108768)
marvintm   
2018-12-27 13:56   
The behaviour is now better than before, as discounts are no longer always lost when splitting the line. However, there is a specific case that is still failing, which will be fixed in a separate issue.