Openbravo Issue Tracking System - Retail Modules
View Issue Details
0023486Retail ModulesDiscounts and Promotionspublic2013-04-04 09:022014-03-05 15:25
guilleaer 
guilleaer 
normalminorhave not tried
closedfixed 
5
 
RR14Q2 
marvintm
No
0023486: Discount Buy X pay Y of different product - Apply to lowest price - No distribute - is not working fine in ERP.
Discount Buy X pay Y of different product - Apply to lowest price - No distribute - is not working fine in ERP.
Create a discount of type Buy X pay Y of different product.

Prom:
Included prod: Only those defined
X Units: 3
X Units: 2
Discount subtype: Apply to lowest price
Distribute between lines -> Unmarked

Prods:
- A: Bootle 1L (price 9.5)
- B: Camel bak 3 L (price 35.5)

Using web POS (correct):
1. login in pos
2. add two units of product a (cheaper) to the order
3. add one unit of product b to the order

Result (working fine):
A discount is applied to product A (cheaper) because we will pay 2 units instead of 3, and the discount should apply to the cheapest one.

Using ERP
1. create a sales order for the same organization and customer of the previous one
2. Create a sales order line for product A (cheaper) with qty 2.
3. Create a sales order line for product B with qty 1.
4. Book the order

RESULT:
No discounts are applied.
Researching in this PL "obdisc_xy_different_product"

I've realized that the affected lines are selected fine, but when the discount is going to be applied this piece of code is executed

            if (v_checkedQty < v_nextY) then
                -- This line participates in the discount, but has not any discount applied,
                -- prevent to apply another discount in cascade
                CLOSE cur_line_candidates;
                RETURN 'N';
            end if;

If the first line analyzed (second line of the order) has less qty than X (1 < 3) we are giving up and the discount is not applied
No tags attached.
related to defect 0053734 closed kousalya_r Openbravo ERP Error: null value in column "pricelist" violates not-null constraint, when Book a Sales Order, 
Issue History
2013-04-04 09:02guilleaerNew Issue
2013-04-04 09:02guilleaerAssigned To => guilleaer
2014-02-28 14:29guilleaerTriggers an Emergency Pack => No
2014-02-28 14:29guilleaerSummaryDiscount Buy X pay Y of different product doesn't works fine from ERP => Discount Buy X pay Y of different product - Apply to lowest price - No distribute - is not working fine in ERP.
2014-02-28 14:29guilleaerDescription Updatedbug_revision_view_page.php?rev_id=5505#r5505
2014-02-28 14:29guilleaerSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=5507#r5507
2014-02-28 14:29guilleaerProposed Solution updated
2014-03-03 10:56hgbotCheckin
2014-03-03 10:56hgbotNote Added: 0064715
2014-03-03 10:57hgbotStatusnew => resolved
2014-03-03 10:57hgbotResolutionopen => fixed
2014-03-03 10:57hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts/rev/d8317277772dc62fe0fe3a80cd0675c8ffe3f930 [^]
2014-03-05 15:25marvintmReview Assigned To => marvintm
2014-03-05 15:25marvintmStatusresolved => closed
2014-03-05 15:25marvintmFixed in Version => RR14Q2
2023-11-17 15:33aferrazRelationship addedrelated to 0053734

Notes
(0064715)
hgbot   
2014-03-03 10:56   
Repository: erp/pmods/org.openbravo.retail.discounts
Changeset: d8317277772dc62fe0fe3a80cd0675c8ffe3f930
Author: Guillermo Alvarez de Eulate <guillermo.alvarez <at> openbravo.com>
Date: Mon Mar 03 10:55:51 2014 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts/rev/d8317277772dc62fe0fe3a80cd0675c8ffe3f930 [^]

fixed issue 23486: disc Buy X pay Y of different product works fine in ERP when CHEAPEST is used

---
M src-db/database/model/functions/OBDISC_XY_DIFFERENT_PRODUCT.xml
---