From b8225276a2d16b8dcd6f9763a354c11d597a97d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sch=C3=B6nbeck?= Date: Wed, 28 Oct 2020 15:15:01 +0100 Subject: [PATCH] Idempiere 4452 (#271) * IDEMPIERE-4452 Allow pricelist schema lines to be dependent of vendor categories and to use entries in m_product_po not marked as current vendor if vendor is selected. * IDEMPIERE-4452 modified update removed * don't check for accidently set IsIgnoreIsCurrentVendor where it doesn't change anything. * IDEMPIERE-4452 set IsIgnoreIsCurrentVendor to false ('N') when no business partner given. --- .../oracle/202009171400_IDEMPIERE-4452.sql | 51 +++++++++++++++++++ .../202009171400_IDEMPIERE-4452.sql | 48 +++++++++++++++++ .../compiere/process/M_PriceList_Create.java | 20 +++++--- .../model/I_M_DiscountSchemaLine.java | 26 ++++++++++ .../compiere/model/MDiscountSchemaLine.java | 13 +++++ .../model/X_M_DiscountSchemaLine.java | 45 +++++++++++++++- 6 files changed, 195 insertions(+), 8 deletions(-) create mode 100644 migration/i7.1z/oracle/202009171400_IDEMPIERE-4452.sql create mode 100644 migration/i7.1z/postgresql/202009171400_IDEMPIERE-4452.sql diff --git a/migration/i7.1z/oracle/202009171400_IDEMPIERE-4452.sql b/migration/i7.1z/oracle/202009171400_IDEMPIERE-4452.sql new file mode 100644 index 0000000000..15cf0626c0 --- /dev/null +++ b/migration/i7.1z/oracle/202009171400_IDEMPIERE-4452.sql @@ -0,0 +1,51 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-4452 +-- Sep 17, 2020, 8:08:18 AM UTC +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203439,0,0,'Y',TO_DATE('2020-09-17 08:08:17','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-09-17 08:08:17','YYYY-MM-DD HH24:MI:SS'),100,'IsIgnoreIsCurrentVendor','Ignore Current Vendor Flag','take all PO prices into account','will use PO price even if it is not marked as current vendor','Ignore Current Vendor Flag','D','2db796b8-1da0-4c9f-b49f-7c63659b5de3') +; + +-- Sep 17, 2020, 8:15:42 AM UTC +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (214315,0,'Ignore Current Vendor Flag','take all PO prices into account','will use PO price even if it is not marked as current vendor',477,'IsIgnoreIsCurrentVendor','N',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_DATE('2020-09-17 08:15:41','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-09-17 08:15:41','YYYY-MM-DD HH24:MI:SS'),100,203439,'Y','N','D','N','N','N','Y','713ddf8e-f924-46a7-a9c2-11003c399dad','Y',0,'N','N','N','N') +; + +-- Sep 17, 2020, 8:16:18 AM UTC +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,IsHtml) VALUES (214316,0,'Partner Category','Product Category of the Business Partner','The Business Partner Category identifies the category used by the Business Partner for this product.',477,'VendorCategory',30,'N','N','N','N','N',0,'N',10,0,0,'Y',TO_DATE('2020-09-17 08:16:18','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-09-17 08:16:18','YYYY-MM-DD HH24:MI:SS'),100,622,'Y','N','D','N','N','N','Y','d3bd3b17-d48d-43d7-9d79-f58aad219bcc','Y',0,'N','N','N') +; + +-- Sep 17, 2020, 8:19:51 AM UTC +ALTER TABLE M_DiscountSchemaLine ADD IsIgnoreIsCurrentVendor CHAR(1) DEFAULT 'N' CHECK (IsIgnoreIsCurrentVendor IN ('Y','N')) NOT NULL +; + +-- Sep 17, 2020, 8:20:37 AM UTC +ALTER TABLE M_DiscountSchemaLine ADD VendorCategory VARCHAR2(30 CHAR) DEFAULT NULL +; + +-- Sep 17, 2020, 8:22:08 AM UTC +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (206508,'Ignore Current Vendor Flag','take all PO prices into account','will use PO price even if it is not marked as current vendor',405,214315,'Y',1,350,'N','N','N','N',0,0,'Y',TO_DATE('2020-09-17 08:22:08','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-09-17 08:22:08','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','0474c725-58a1-48ec-8f41-b82b3d058aeb','Y',350,2,2) +; + +-- Sep 17, 2020, 8:22:09 AM UTC +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (206509,'Partner Category','Product Category of the Business Partner','The Business Partner Category identifies the category used by the Business Partner for this product.',405,214316,'Y',30,360,'N','N','N','N',0,0,'Y',TO_DATE('2020-09-17 08:22:08','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-09-17 08:22:08','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','e6507320-a3e5-4188-b57a-63ff234e2e26','Y',360,2) +; + +-- Sep 17, 2020, 8:25:08 AM UTC +UPDATE AD_Field SET SeqNo=95, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, SeqNoGrid=85, IsToolbarButton=NULL,Updated=TO_DATE('2020-09-17 08:25:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206508 +; + +-- Sep 17, 2020, 8:29:13 AM UTC +UPDATE AD_Field SET DisplayLogic='@DiscountType@=P & @C_BPartner_ID@!0', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-09-17 08:29:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206508 +; + +-- Sep 17, 2020, 8:30:14 AM UTC +UPDATE AD_Field SET SeqNo=145, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, SeqNoGrid=135, IsToolbarButton=NULL,Updated=TO_DATE('2020-09-17 08:30:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206509 +; + +-- Sep 17, 2020, 8:45:45 AM UTC +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, IsToolbarButton=NULL,Updated=TO_DATE('2020-09-17 08:45:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206508 +; + +SELECT register_migration_script('202009171400_IDEMPIERE-4452.sql') FROM dual +; + diff --git a/migration/i7.1z/postgresql/202009171400_IDEMPIERE-4452.sql b/migration/i7.1z/postgresql/202009171400_IDEMPIERE-4452.sql new file mode 100644 index 0000000000..4b9452f7a1 --- /dev/null +++ b/migration/i7.1z/postgresql/202009171400_IDEMPIERE-4452.sql @@ -0,0 +1,48 @@ +-- IDEMPIERE-4452 +-- Sep 17, 2020, 8:08:18 AM UTC +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203439,0,0,'Y',TO_TIMESTAMP('2020-09-17 08:08:17','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-09-17 08:08:17','YYYY-MM-DD HH24:MI:SS'),100,'IsIgnoreIsCurrentVendor','Ignore Current Vendor Flag','take all PO prices into account','will use PO price even if it is not marked as current vendor','Ignore Current Vendor Flag','D','2db796b8-1da0-4c9f-b49f-7c63659b5de3') +; + +-- Sep 17, 2020, 8:15:42 AM UTC +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (214315,0,'Ignore Current Vendor Flag','take all PO prices into account','will use PO price even if it is not marked as current vendor',477,'IsIgnoreIsCurrentVendor','N',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2020-09-17 08:15:41','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-09-17 08:15:41','YYYY-MM-DD HH24:MI:SS'),100,203439,'Y','N','D','N','N','N','Y','713ddf8e-f924-46a7-a9c2-11003c399dad','Y',0,'N','N','N','N') +; + +-- Sep 17, 2020, 8:16:18 AM UTC +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,IsHtml) VALUES (214316,0,'Partner Category','Product Category of the Business Partner','The Business Partner Category identifies the category used by the Business Partner for this product.',477,'VendorCategory',30,'N','N','N','N','N',0,'N',10,0,0,'Y',TO_TIMESTAMP('2020-09-17 08:16:18','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-09-17 08:16:18','YYYY-MM-DD HH24:MI:SS'),100,622,'Y','N','D','N','N','N','Y','d3bd3b17-d48d-43d7-9d79-f58aad219bcc','Y',0,'N','N','N') +; + +-- Sep 17, 2020, 8:19:51 AM UTC +ALTER TABLE M_DiscountSchemaLine ADD COLUMN IsIgnoreIsCurrentVendor CHAR(1) DEFAULT 'N' CHECK (IsIgnoreIsCurrentVendor IN ('Y','N')) NOT NULL +; + +-- Sep 17, 2020, 8:20:37 AM UTC +ALTER TABLE M_DiscountSchemaLine ADD COLUMN VendorCategory VARCHAR(30) DEFAULT NULL +; + + +-- Sep 17, 2020, 8:22:08 AM UTC +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (206508,'Ignore Current Vendor Flag','take all PO prices into account','will use PO price even if it is not marked as current vendor',405,214315,'Y',1,350,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2020-09-17 08:22:08','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-09-17 08:22:08','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','0474c725-58a1-48ec-8f41-b82b3d058aeb','Y',350,2,2) +; + +-- Sep 17, 2020, 8:22:09 AM UTC +INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (206509,'Partner Category','Product Category of the Business Partner','The Business Partner Category identifies the category used by the Business Partner for this product.',405,214316,'Y',30,360,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2020-09-17 08:22:08','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-09-17 08:22:08','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','e6507320-a3e5-4188-b57a-63ff234e2e26','Y',360,2) +; + +-- Sep 17, 2020, 8:25:08 AM UTC +UPDATE AD_Field SET SeqNo=95, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, SeqNoGrid=85, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-09-17 08:25:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206508 +; + +-- Sep 17, 2020, 8:29:13 AM UTC +UPDATE AD_Field SET DisplayLogic='@DiscountType@=P & @C_BPartner_ID@!0', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-09-17 08:29:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206508 +; + +-- Sep 17, 2020, 8:30:14 AM UTC +UPDATE AD_Field SET SeqNo=145, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, SeqNoGrid=135, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-09-17 08:30:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206509 +; + +-- Sep 17, 2020, 8:45:45 AM UTC +UPDATE AD_Field SET AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-09-17 08:45:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206508 +; + +SELECT register_migration_script('202009171400_IDEMPIERE-4452.sql') FROM dual +; diff --git a/org.adempiere.base.process/src/org/compiere/process/M_PriceList_Create.java b/org.adempiere.base.process/src/org/compiere/process/M_PriceList_Create.java index 9c507c0404..b3bb513c88 100644 --- a/org.adempiere.base.process/src/org/compiere/process/M_PriceList_Create.java +++ b/org.adempiere.base.process/src/org/compiere/process/M_PriceList_Create.java @@ -218,11 +218,13 @@ public class M_PriceList_Create extends SvrProcess { + " INNER JOIN M_Product p ON (p.M_Product_ID=po.M_Product_ID)" + " INNER JOIN M_DiscountSchemaLine dl ON (dl.M_DiscountSchemaLine_ID=?) " // #2 + "WHERE p.AD_Client_ID IN (?, 0)" // #3 - + " AND p.IsActive='Y' AND po.IsActive='Y' AND po.IsCurrentVendor='Y'" + + " AND p.IsActive='Y' AND po.IsActive='Y'" // Optional Restrictions + " AND (dl.Group1 IS NULL OR p.Group1=dl.Group1)" + " AND (dl.Group2 IS NULL OR p.Group2=dl.Group2)" - + " AND (dl.C_BPartner_ID IS NULL OR po.C_BPartner_ID=dl.C_BPartner_ID)" + + " AND (dl.C_BPartner_ID IS NULL OR po.C_BPartner_ID=dl.C_BPartner_ID)" + + " AND (dl.VendorCategory IS NULL OR po.VendorCategory=dl.VendorCategory)" + + " AND (dl.IsIgnoreIsCurrentVendor='Y' OR po.IsCurrentVendor='Y')" + " AND (dl.M_Product_ID IS NULL OR p.M_Product_ID=dl.M_Product_ID)"); if (dsLine.getM_Product_Category_ID() > 0) { sqlb.append(" AND p.M_Product_Category_ID IN (") @@ -240,10 +242,12 @@ public class M_PriceList_Create extends SvrProcess { // Optional Restrictions + " AND (dl.Group1 IS NULL OR p.Group1=dl.Group1)" + " AND (dl.Group2 IS NULL OR p.Group2=dl.Group2)" - + " AND (dl.C_BPartner_ID IS NULL OR EXISTS " - + "(SELECT * FROM M_Product_PO po " - + "WHERE po.M_Product_ID=p.M_Product_ID AND po.C_BPartner_ID=dl.C_BPartner_ID))" - + " AND (dl.M_Product_ID IS NULL OR p.M_Product_ID=dl.M_Product_ID)"); + + " AND ((dl.C_BPartner_ID IS NULL AND dl.VendorCategory IS NULL) OR EXISTS " + + "(SELECT * FROM M_Product_PO po" + + " WHERE po.M_Product_ID=p.M_Product_ID" + + " AND (dl.C_BPartner_ID IS NULL OR po.C_BPartner_ID=dl.C_BPartner_ID)" + + " AND (dl.VendorCategory IS NULL OR po.VendorCategory=dl.VendorCategory)))" + + " AND (dl.M_Product_ID IS NULL OR p.M_Product_ID=dl.M_Product_ID)"); if (dsLine.getM_Product_Category_ID() > 0) { sqlb.append(" AND p.M_Product_Category_ID IN (") .append(getSubCategoryWhereClause(dsLine.getM_Product_Category_ID())) @@ -295,7 +299,9 @@ public class M_PriceList_Create extends SvrProcess { + " INNER JOIN M_DiscountSchemaLine dl ON (dl.M_DiscountSchemaLine_ID=?) " // #3 // + "WHERE EXISTS (SELECT * FROM T_Selection s WHERE s.AD_PInstance_ID=? AND po.M_Product_ID=s.T_Selection_ID)" // #4 - + " AND po.IsCurrentVendor='Y' AND po.IsActive='Y'"; + + " AND ((dl.C_BPartner_ID IS NULL AND po.IsCurrentVendor='Y')" + + " OR (po.C_BPartner_ID=dl.C_BPartner_ID AND (dl.IsIgnoreIsCurrentVendor='Y' OR po.IsCurrentVendor='Y')))" + + " AND po.IsActive='Y'"; } else { /** Copy and Convert from other PriceList_Version */ sql += "SELECT plv.M_PriceList_Version_ID, pp.M_Product_ID," diff --git a/org.adempiere.base/src/org/compiere/model/I_M_DiscountSchemaLine.java b/org.adempiere.base/src/org/compiere/model/I_M_DiscountSchemaLine.java index c8d5196e5d..76c97c5e6b 100644 --- a/org.adempiere.base/src/org/compiere/model/I_M_DiscountSchemaLine.java +++ b/org.adempiere.base/src/org/compiere/model/I_M_DiscountSchemaLine.java @@ -178,6 +178,19 @@ public interface I_M_DiscountSchemaLine */ public boolean isActive(); + /** Column name IsIgnoreIsCurrentVendor */ + public static final String COLUMNNAME_IsIgnoreIsCurrentVendor = "IsIgnoreIsCurrentVendor"; + + /** Set Ignore Current Vendor Flag. + * take all PO prices into account + */ + public void setIsIgnoreIsCurrentVendor (boolean IsIgnoreIsCurrentVendor); + + /** Get Ignore Current Vendor Flag. + * take all PO prices into account + */ + public boolean isIgnoreIsCurrentVendor(); + /** Column name Limit_AddAmt */ public static final String COLUMNNAME_Limit_AddAmt = "Limit_AddAmt"; @@ -552,4 +565,17 @@ public interface I_M_DiscountSchemaLine * User who updated this records */ public int getUpdatedBy(); + + /** Column name VendorCategory */ + public static final String COLUMNNAME_VendorCategory = "VendorCategory"; + + /** Set Partner Category. + * Product Category of the Business Partner + */ + public void setVendorCategory (String VendorCategory); + + /** Get Partner Category. + * Product Category of the Business Partner + */ + public String getVendorCategory(); } diff --git a/org.adempiere.base/src/org/compiere/model/MDiscountSchemaLine.java b/org.adempiere.base/src/org/compiere/model/MDiscountSchemaLine.java index 36dc9e11b4..f48399d10d 100644 --- a/org.adempiere.base/src/org/compiere/model/MDiscountSchemaLine.java +++ b/org.adempiere.base/src/org/compiere/model/MDiscountSchemaLine.java @@ -98,4 +98,17 @@ public class MDiscountSchemaLine extends X_M_DiscountSchemaLine implements Immut return this; } + /** + * Before Save + * @param newRecord new + * @return true + */ + protected boolean beforeSave (boolean newRecord) + { + if (getC_BPartner_ID() == 0) + setIsIgnoreIsCurrentVendor(false); + + return true; + } // beforeSave + } // MDiscountSchemaLine diff --git a/org.adempiere.base/src/org/compiere/model/X_M_DiscountSchemaLine.java b/org.adempiere.base/src/org/compiere/model/X_M_DiscountSchemaLine.java index 88838a60e9..fb908f7171 100644 --- a/org.adempiere.base/src/org/compiere/model/X_M_DiscountSchemaLine.java +++ b/org.adempiere.base/src/org/compiere/model/X_M_DiscountSchemaLine.java @@ -33,7 +33,7 @@ public class X_M_DiscountSchemaLine extends PO implements I_M_DiscountSchemaLine /** * */ - private static final long serialVersionUID = 20200623L; + private static final long serialVersionUID = 20201027L; /** Standard Constructor */ public X_M_DiscountSchemaLine (Properties ctx, int M_DiscountSchemaLine_ID, String trxName) @@ -44,6 +44,8 @@ public class X_M_DiscountSchemaLine extends PO implements I_M_DiscountSchemaLine setC_ConversionType_ID (0); setConversionDate (new Timestamp( System.currentTimeMillis() )); // @#Date@ + setIsIgnoreIsCurrentVendor (false); +// N setLimit_AddAmt (Env.ZERO); setLimit_Base (null); // X @@ -238,6 +240,30 @@ public class X_M_DiscountSchemaLine extends PO implements I_M_DiscountSchemaLine return (String)get_Value(COLUMNNAME_Group2); } + /** Set Ignore Current Vendor Flag. + @param IsIgnoreIsCurrentVendor + take all PO prices into account + */ + public void setIsIgnoreIsCurrentVendor (boolean IsIgnoreIsCurrentVendor) + { + set_Value (COLUMNNAME_IsIgnoreIsCurrentVendor, Boolean.valueOf(IsIgnoreIsCurrentVendor)); + } + + /** Get Ignore Current Vendor Flag. + @return take all PO prices into account + */ + public boolean isIgnoreIsCurrentVendor () + { + Object oo = get_Value(COLUMNNAME_IsIgnoreIsCurrentVendor); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + /** Set Limit price Surcharge Amount. @param Limit_AddAmt Amount added to the converted/copied price before multiplying @@ -896,4 +922,21 @@ public class X_M_DiscountSchemaLine extends PO implements I_M_DiscountSchemaLine { return (String)get_Value(COLUMNNAME_Std_Rounding); } + + /** Set Partner Category. + @param VendorCategory + Product Category of the Business Partner + */ + public void setVendorCategory (String VendorCategory) + { + set_Value (COLUMNNAME_VendorCategory, VendorCategory); + } + + /** Get Partner Category. + @return Product Category of the Business Partner + */ + public String getVendorCategory () + { + return (String)get_Value(COLUMNNAME_VendorCategory); + } } \ No newline at end of file