Openbravo Issue Tracking System - Retail Modules
View Issue Details
0042912Retail ModulesDiscounts and Promotionspublic2020-01-15 10:442020-02-17 12:51
santi_lozano 
markmm82 
highmajoralways
closedfixed 
5
 
RR19Q4.2RR19Q4.2 
guilleaer
No
0042912: 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.
blocks defect 0042883 closed markmm82 Promotions or discounts for a concrete characteristic are not being applied well 
Issue History
2020-01-16 15:36marvintmTypedefect => backport
2020-01-16 15:36marvintmTarget Version => RR19Q4.2
2020-01-28 19:51hgbotCheckin
2020-01-28 19:51hgbotNote Added: 0117307
2020-01-28 19:51hgbotStatusscheduled => resolved
2020-01-28 19:51hgbotResolutionopen => fixed
2020-01-28 19:51hgbotFixed in SCM revision => http://code.openbravo.com/retail/backports/3.0RR19Q4.2/org.openbravo.retail.posterminal/rev/9edebd4b3dbf309fdac90fad4a7a9049852469c2 [^]
2020-02-17 12:51guilleaerReview Assigned To => guilleaer
2020-02-17 12:51guilleaerStatusresolved => closed
2020-02-17 12:51guilleaerFixed in Version => RR19Q4.2

Notes
(0117307)
hgbot   
2020-01-28 19:51   
Repository: retail/backports/3.0RR19Q4.2/org.openbravo.retail.posterminal
Changeset: 9edebd4b3dbf309fdac90fad4a7a9049852469c2
Author: Mark Molina <mark.molina <at> doceleguas.com>
Date: Tue Jan 28 10:41:46 2020 -0300
URL: http://code.openbravo.com/retail/backports/3.0RR19Q4.2/org.openbravo.retail.posterminal/rev/9edebd4b3dbf309fdac90fad4a7a9049852469c2 [^]

Fixed issue 42912: 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
---