diff --git a/base/src/org/compiere/model/MDiscountSchemaBreak.java b/base/src/org/compiere/model/MDiscountSchemaBreak.java
index 43f507b785..0178f6677a 100644
--- a/base/src/org/compiere/model/MDiscountSchemaBreak.java
+++ b/base/src/org/compiere/model/MDiscountSchemaBreak.java
@@ -26,6 +26,9 @@ import java.util.*;
*
* @author Jorg Janke
* @version $Id: MDiscountSchemaBreak.java,v 1.3 2006/07/30 00:51:05 jjanke Exp $
+ *
+ * @author Teo Sarca, SC ARHIPAC SERVICE SRL
+ *
BF [ 2012439 ] DiscountSchemaBreak: setting product & category is allowed
*/
public class MDiscountSchemaBreak extends X_M_DiscountSchemaBreak
{
@@ -86,6 +89,15 @@ public class MDiscountSchemaBreak extends X_M_DiscountSchemaBreak
return MProductCategory.isCategory(getM_Product_Category_ID(), M_Product_ID);
} // applies
+ @Override
+ protected boolean beforeSave(boolean newRecord) {
+ // If M_Product_ID and M_Product_Category_ID is set, M_Product_ID has priority - teo_sarca [ 2012439 ]
+ if (getM_Product_ID() > 0 && getM_Product_Category_ID() > 0)
+ setM_Product_Category_ID(I_ZERO);
+ //
+ return true;
+ }
+
/**
* String Representation
* @return info
diff --git a/migration/351a-trunk/217_BF2012439.sql b/migration/351a-trunk/217_BF2012439.sql
new file mode 100644
index 0000000000..dbfaac2a65
--- /dev/null
+++ b/migration/351a-trunk/217_BF2012439.sql
@@ -0,0 +1,10 @@
+-- 07.07.2008 15:22:56 EEST
+--
+UPDATE AD_Column SET ReadOnlyLogic='@M_Product_ID@!0',Updated=TO_DATE('2008-07-07 15:22:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=6610
+;
+
+-- 07.07.2008 15:23:12 EEST
+--
+UPDATE AD_Column SET ReadOnlyLogic='@M_Product_Category_ID@!0',Updated=TO_DATE('2008-07-07 15:23:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=6611
+;
+
diff --git a/migration/351a-trunk/postgresql/217_BF2012439.sql b/migration/351a-trunk/postgresql/217_BF2012439.sql
new file mode 100644
index 0000000000..70971f5f4f
--- /dev/null
+++ b/migration/351a-trunk/postgresql/217_BF2012439.sql
@@ -0,0 +1,10 @@
+-- 07.07.2008 15:22:56 EEST
+--
+UPDATE AD_Column SET ReadOnlyLogic='@M_Product_ID@!0',Updated=TO_TIMESTAMP('2008-07-07 15:22:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=6610
+;
+
+-- 07.07.2008 15:23:12 EEST
+--
+UPDATE AD_Column SET ReadOnlyLogic='@M_Product_Category_ID@!0',Updated=TO_TIMESTAMP('2008-07-07 15:23:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=6611
+;
+