Openbravo Issue Tracking System - Retail Modules
View Issue Details
0042883Retail ModulesDiscounts and Promotionspublic2020-01-15 10:442020-02-10 19:17
santi_lozano 
markmm82 
highmajoralways
closedfixed 
5
 
RR20Q2 
guilleaer
No
0042883: Promotions or discounts for a concrete characteristic are not being applied well
After adding a discount for a concrete characteristic on back office, on web POS adding products to the ticket with that characteristic results in the discount only being applied when next product is added to the ticket (see images attached)
* go to Openbravo livebuilds section Retail with module (pgsql link for back office, webpos for web POS)
* Go to back office, change role to The White Valley Group Admin
* create a new discount / promotion on window Discounts and Promotions. Organization = *, Discount/Promotion Type = Fixed Percentage Discount, Name = whatever test, Printed Name = whatever test, Starting Date = “today”, Priority = 10, Included Characteristics = Only those defined, Discount % = 10. On tab Characteristics create a new record: Active = Yes, Characteristic = Capacity, Characteristic Value = Under 2L.
* go to Web POS, search for products, select Capacity, on the popup select Under 2L, add the first one to the ticket
* the discount has not been applied
* add the second one to the ticket
* the discount is now applied to the product we added before only
No tags attached.
depends on backport 0042911RR20Q1 closed markmm82 Promotions or discounts for a concrete characteristic are not being applied well 
depends on backport 0042912RR19Q4.2 closed markmm82 Promotions or discounts for a concrete characteristic are not being applied well 
png 14190 - reproducido en livebuilds.png (234,465) 2020-01-15 10:44
https://issues.openbravo.com/file_download.php?file_id=13834&type=bug
png

png 14190 - livebuilds config mine.png (114,252) 2020-01-15 10:45
https://issues.openbravo.com/file_download.php?file_id=13835&type=bug
png
Issue History
2020-01-15 10:44santi_lozanoNew Issue
2020-01-15 10:44santi_lozanoAssigned To => Retail
2020-01-15 10:44santi_lozanoFile Added: 14190 - reproducido en livebuilds.png
2020-01-15 10:44santi_lozanoResolution time => 1580857200
2020-01-15 10:44santi_lozanoTriggers an Emergency Pack => No
2020-01-15 10:45santi_lozanoFile Added: 14190 - livebuilds config mine.png
2020-01-16 15:36marvintmAssigned ToRetail => markmm82
2020-01-16 15:36marvintmStatusnew => scheduled
2020-01-27 19:04martinsdanIssue Monitored: martinsdan
2020-01-28 19:47hgbotCheckin
2020-01-28 19:47hgbotNote Added: 0117305
2020-01-28 19:47hgbotStatusscheduled => resolved
2020-01-28 19:47hgbotResolutionopen => fixed
2020-01-28 19:47hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/d24f1bca5e5c595577406ca0000f7321eeb9be2c [^]
2020-01-29 09:38guilleaerReview Assigned To => guilleaer
2020-01-29 09:38guilleaerStatusresolved => closed
2020-01-29 09:38guilleaerFixed in Version => RR20Q2
2020-02-10 19:17hgbotCheckin
2020-02-10 19:17hgbotNote Added: 0117614

Notes
(0117305)
hgbot   
2020-01-28 19:47   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: d24f1bca5e5c595577406ca0000f7321eeb9be2c
Author: Mark Molina <mark.molina <at> doceleguas.com>
Date: Mon Jan 27 11:48:20 2020 -0300
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/d24f1bca5e5c595577406ca0000f7321eeb9be2c [^]

Fixed issue 42883: Correctly applied promotions to product with characteristics

Promotions or discounts for a concrete characteristic was not being applied well
because the first time the product was added to the ticket, a new line was created
and finally as the last step, the product characteristics was updated to the line.
The discount engine was verifying if was possible to apply the discount for products
with characteristics defined in the rule, but it was happening before the product
characteristic list of the product was updated in model, so the rule was been marked
as not possible to apply to the new created line.

To fix this issue, was updated the product model to be added into the ticket, with
all it characteristics before adding the product to the line, and execute the discount
validations.
This fix updates the productCharacteristics attribute of the product model before
the line is created, instead of update the line itself after the line was created
and discounts validations fired.

As the product characteristics are updated previously to create the line (before
the OBPOS_PreAddProductToOrder hook is executed), it is not needed to do this when
the OBPOS_PostAddProductToOrder hook is executed, so the execution at this point of
the code was removed.

---
M web/org.openbravo.retail.posterminal/js/model/order.js
---
(0117614)
hgbot   
2020-02-10 19:17   
Repository: erp/pmods/org.openbravo.retail.discounts
Changeset: a36b49a84e7ca574fe7f251f4c8470cfc5b4018b
Author: Mark Molina <mark.molina <at> doceleguas.com>
Date: Mon Feb 10 15:13:51 2020 -0300
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts/rev/a36b49a84e7ca574fe7f251f4c8470cfc5b4018b [^]

Related to issue 42883: Created test for promotions with product characteristics

---
M src-test/org/openbravo/retail/discounts/test/base/model/Product.java
M src-test/org/openbravo/retail/discounts/test/unittests/DiscountsUnitTestSuite.java
A src-test/org/openbravo/retail/discounts/test/unittests/combined/I42883_DiscountsByCharacteristicIsWellApplied.java
---