diff -r 256aafefe94f src-db/database/model/functions/OBDISC_XY_DIFFERENT_PRODUCT.xml
--- a/src-db/database/model/functions/OBDISC_XY_DIFFERENT_PRODUCT.xml	Wed Mar 06 04:53:21 2013 +0000
+++ b/src-db/database/model/functions/OBDISC_XY_DIFFERENT_PRODUCT.xml	Wed Apr 03 18:45:24 2013 +0200
@@ -250,7 +250,7 @@
     v_avgPrice := v_totalPrice / v_unitsToCheck;
   end if;
 
-  v_nextY := v_y;
+  v_nextY := v_x;
   v_checkedQty := 0;
   v_distributionQty := 0;
   v_distributionAmt := 0;
@@ -271,9 +271,9 @@
 
 			v_chunksInThisGroup := 0;
 			loop
-				exit when v_nextY >= v_checkedQty;
+				exit when v_nextY > v_checkedQty;
 				
-				v_chunksInThisGroup := v_chunksInThisGroup + 1;
+				v_chunksInThisGroup := v_chunksInThisGroup + (v_x - v_y);
 				v_nextY := v_nextY + v_x;
 
 			end loop;
diff -r 256aafefe94f web/org.openbravo.retail.discounts/js/promotion-XYdifferentProduts.js
--- a/web/org.openbravo.retail.discounts/js/promotion-XYdifferentProduts.js	Wed Mar 06 04:53:21 2013 +0000
+++ b/web/org.openbravo.retail.discounts/js/promotion-XYdifferentProduts.js	Wed Apr 03 18:45:24 2013 +0200
@@ -85,7 +85,7 @@
       }
 
       distributed = discountRule.get('oBDISCDistribute');
-      nextY = y;
+      nextY = x;
       checkedQty = BigDecimal.prototype.ZERO;
       for (i = 0; i < group.length; i++) {
         ln = group.at(i);
@@ -94,7 +94,7 @@
         checkedQty = checkedQty.add(lQty);
 
         if (subtype === 'CHEAPEST') {
-          if (OB.DEC.toNumber(checkedQty) <= nextY) {
+          if (OB.DEC.toNumber(checkedQty) < nextY) {
             // Create a fake discount to mark this line as used by a discount
             // preventing cascade in this way
             receipt.addPromotion(ln, discountRule, {
@@ -103,8 +103,8 @@
             });
           } else {
             chunksInThisGroup = 0;
-            while (nextY < OB.DEC.toNumber(checkedQty)) {
-              chunksInThisGroup += 1;
+            while (nextY <= OB.DEC.toNumber(checkedQty)) {
+              chunksInThisGroup += x - y;
               nextY += x;
             }
             amt = price.multiply(OB.DEC.toBigDecimal(chunksInThisGroup));
