IDEMPIERE-5807 Add ability to specify attribute set when importing products (#1950)

This commit is contained in:
Jasper Siepkes 2023-07-29 04:13:07 +02:00 committed by GitHub
parent c85cc9fe7a
commit f689b0f630
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 270 additions and 1 deletions

View File

@ -0,0 +1,114 @@
-- IDEMPIERE-5807 Add ability to specify attribute set when importing products
SELECT register_migration_script('202307241036_IDEMPIERE-5807.sql') FROM dual;
SET SQLBLANKLINES ON
SET DEFINE OFF
-- Jul 24, 2023, 10:36:38 AM CEST
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,FKConstraintName,FKConstraintType,IsHtml) VALUES (215906,1.00,'Attribute Set','Product Attribute Set','Define Product Attribute Sets to add additional attributes and values to the product. You need to define a Attribute Set if you want to enable Serial and Lot Number tracking.',532,'M_AttributeSet_ID',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2023-07-24 10:36:37','YYYY-MM-DD HH24:MI:SS'),10,TO_TIMESTAMP('2023-07-24 10:36:37','YYYY-MM-DD HH24:MI:SS'),10,2017,'Y','N','D','N','N','N','N','ce9a930a-ff98-47b8-b0d0-4ff3ee6c2f88','Y',0,'N','N','mattributeset_iproduct','S','N')
;
-- Jul 24, 2023, 10:36:42 AM CEST
ALTER TABLE I_Product ADD M_AttributeSet_ID NUMBER(10) DEFAULT NULL
;
-- Jul 24, 2023, 10:36:42 AM CEST
ALTER TABLE I_Product ADD CONSTRAINT mattributeset_iproduct FOREIGN KEY (M_AttributeSet_ID) REFERENCES m_attributeset(m_attributeset_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED
;
-- Jul 24, 2023, 10:41:52 AM CEST
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 (207713,'Attribute Set','Product Attribute Set','Define Product Attribute Sets to add additional attributes and values to the product. You need to define a Attribute Set if you want to enable Serial and Lot Number tracking.',442,215906,'Y',22,520,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-07-24 10:41:52','YYYY-MM-DD HH24:MI:SS'),10,TO_TIMESTAMP('2023-07-24 10:41:52','YYYY-MM-DD HH24:MI:SS'),10,'N','Y','D','e0ba7938-158e-450c-9938-32ccc83d9098','Y',520,2)
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=310, XPosition=1,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=207713
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=320,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=206546
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=330,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=206547
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=340,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5986
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=350,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5985
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=360,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5958
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=370,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5977
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=380,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5982
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=390,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5999
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=400,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=12420
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=410,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=12419
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=420,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5975
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=430,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5963
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=440,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5960
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=450,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5973
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=460,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5988
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=470,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5996
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=480,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5968
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=490,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5971
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=500,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5970
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=510,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5993
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=520,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5965
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=0,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=204866
;

View File

@ -0,0 +1,111 @@
-- IDEMPIERE-5807 Add ability to specify attribute set when importing products
SELECT register_migration_script('202307241036_IDEMPIERE-5807.sql') FROM dual;
-- Jul 24, 2023, 10:36:38 AM CEST
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,FKConstraintName,FKConstraintType,IsHtml) VALUES (215906,1.00,'Attribute Set','Product Attribute Set','Define Product Attribute Sets to add additional attributes and values to the product. You need to define a Attribute Set if you want to enable Serial and Lot Number tracking.',532,'M_AttributeSet_ID',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2023-07-24 10:36:37','YYYY-MM-DD HH24:MI:SS'),10,TO_TIMESTAMP('2023-07-24 10:36:37','YYYY-MM-DD HH24:MI:SS'),10,2017,'Y','N','D','N','N','N','N','ce9a930a-ff98-47b8-b0d0-4ff3ee6c2f88','Y',0,'N','N','mattributeset_iproduct','S','N')
;
-- Jul 24, 2023, 10:36:42 AM CEST
ALTER TABLE I_Product ADD COLUMN M_AttributeSet_ID NUMERIC(10) DEFAULT NULL
;
-- Jul 24, 2023, 10:36:42 AM CEST
ALTER TABLE I_Product ADD CONSTRAINT mattributeset_iproduct FOREIGN KEY (M_AttributeSet_ID) REFERENCES m_attributeset(m_attributeset_id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED
;
-- Jul 24, 2023, 10:41:52 AM CEST
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 (207713,'Attribute Set','Product Attribute Set','Define Product Attribute Sets to add additional attributes and values to the product. You need to define a Attribute Set if you want to enable Serial and Lot Number tracking.',442,215906,'Y',22,520,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2023-07-24 10:41:52','YYYY-MM-DD HH24:MI:SS'),10,TO_TIMESTAMP('2023-07-24 10:41:52','YYYY-MM-DD HH24:MI:SS'),10,'N','Y','D','e0ba7938-158e-450c-9938-32ccc83d9098','Y',520,2)
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=310, XPosition=1,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=207713
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=320,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=206546
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=330,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=206547
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=340,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5986
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=350,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5985
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=360,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5958
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=370,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5977
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=380,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5982
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=390,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5999
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=400,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=12420
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=410,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=12419
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=420,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5975
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=430,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5963
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=440,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5960
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=450,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5973
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=460,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5988
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=470,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5996
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=480,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5968
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=490,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5971
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=500,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5970
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=510,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5993
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=520,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=5965
;
-- Jul 24, 2023, 10:42:59 AM CEST
UPDATE AD_Field SET SeqNo=0,Updated=TO_TIMESTAMP('2023-07-24 10:42:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=10 WHERE AD_Field_ID=204866
;

View File

@ -384,6 +384,21 @@ public interface I_I_Product
*/
public String getManufacturer();
/** Column name M_AttributeSet_ID */
public static final String COLUMNNAME_M_AttributeSet_ID = "M_AttributeSet_ID";
/** Set Attribute Set.
* Product Attribute Set
*/
public void setM_AttributeSet_ID (int M_AttributeSet_ID);
/** Get Attribute Set.
* Product Attribute Set
*/
public int getM_AttributeSet_ID();
public org.compiere.model.I_M_AttributeSet getM_AttributeSet() throws RuntimeException;
/** Column name M_Product_Category_ID */
public static final String COLUMNNAME_M_Product_Category_ID = "M_Product_Category_ID";

View File

@ -327,6 +327,7 @@ public class MProduct extends X_M_Product implements ImmutablePOSupport
setCustomsTariffNumber(impP.getCustomsTariffNumber());
setGroup1(impP.getGroup1());
setGroup2(impP.getGroup2());
setM_AttributeSet_ID(impP.getM_AttributeSet_ID());
} // MProduct
/**

View File

@ -34,7 +34,7 @@ public class X_I_Product extends PO implements I_I_Product, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20230409L;
private static final long serialVersionUID = 20230721L;
/** Standard Constructor */
public X_I_Product (Properties ctx, int I_Product_ID, String trxName)
@ -535,6 +535,34 @@ public class X_I_Product extends PO implements I_I_Product, I_Persistent
return (String)get_Value(COLUMNNAME_Manufacturer);
}
public org.compiere.model.I_M_AttributeSet getM_AttributeSet() throws RuntimeException
{
return (org.compiere.model.I_M_AttributeSet)MTable.get(getCtx(), org.compiere.model.I_M_AttributeSet.Table_ID)
.getPO(getM_AttributeSet_ID(), get_TrxName());
}
/** Set Attribute Set.
@param M_AttributeSet_ID Product Attribute Set
*/
public void setM_AttributeSet_ID (int M_AttributeSet_ID)
{
if (M_AttributeSet_ID < 0)
set_Value (COLUMNNAME_M_AttributeSet_ID, null);
else
set_Value (COLUMNNAME_M_AttributeSet_ID, Integer.valueOf(M_AttributeSet_ID));
}
/** Get Attribute Set.
@return Product Attribute Set
*/
public int getM_AttributeSet_ID()
{
Integer ii = (Integer)get_Value(COLUMNNAME_M_AttributeSet_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_M_Product_Category getM_Product_Category() throws RuntimeException
{
return (org.compiere.model.I_M_Product_Category)MTable.get(getCtx(), org.compiere.model.I_M_Product_Category.Table_ID)