diff --git a/web/org.openbravo.retail.discounts.bytotal/js/promotion-freeitemstotal.js b/web/org.openbravo.retail.discounts.bytotal/js/promotion-freeitemstotal.js
index 8c88a8c..31e1aca 100644
--- a/web/org.openbravo.retail.discounts.bytotal/js/promotion-freeitemstotal.js
+++ b/web/org.openbravo.retail.discounts.bytotal/js/promotion-freeitemstotal.js
@@ -87,4 +87,12 @@ OB.Model.Discounts.discountRules['4755A35B4DA34F6CB08F15462BA123CF'] = {
       listener.trigger('completed');
     });
   }
-};
\ No newline at end of file
+};
+OB.Model.Discounts.additionalWhereClause.push({
+  generateWhereClause: function(context, receipt, line) {
+    return ' or case when m_offer.PRODUCT_SELECTION = "Y" then false ' + //
+    'else true AND EXISTS (SELECT 1 FROM disct_freeproduct ' + //
+    'WHERE disct_freeproduct.m_offer_id = m_offer.m_offer_id ' + //
+    'AND disct_freeproduct.m_product_id = "' + line.get('product').get('id') + '") end';
+  }
+});
