From 2ea4730458ea5b73b1f24b93aead7e6a51f16d39 Mon Sep 17 00:00:00 2001 From: Vitor Villa <80797997+VitorVilla@users.noreply.github.com> Date: Wed, 11 Dec 2024 18:45:23 -0300 Subject: [PATCH] IDEMPIERE-6335 - Create parameter to specify document type in material receipt (#2581) * IDEMPIERE-6335 - Create parameter to specify document type in material receipt * IDEMPIERE-6335 - Adjust to use centralized ID management * IDEMPIERE-6335 - apply the patch --- migration/iD11/oracle/202412101102_IDEMPIERE-6335.sql | 10 ++++++++++ .../iD11/postgresql/202412101102_IDEMPIERE-6335.sql | 7 +++++++ .../src/org/compiere/process/InvoiceCreateInOut.java | 9 ++++++++- 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 migration/iD11/oracle/202412101102_IDEMPIERE-6335.sql create mode 100644 migration/iD11/postgresql/202412101102_IDEMPIERE-6335.sql diff --git a/migration/iD11/oracle/202412101102_IDEMPIERE-6335.sql b/migration/iD11/oracle/202412101102_IDEMPIERE-6335.sql new file mode 100644 index 0000000000..57a2a7375d --- /dev/null +++ b/migration/iD11/oracle/202412101102_IDEMPIERE-6335.sql @@ -0,0 +1,10 @@ +-- IDEMPIERE-6335 +SELECT register_migration_script('202412101102_IDEMPIERE-6335.sql') FROM dual; + +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Dec 10, 2024, 11:06:45 AM BRT +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted,IsAutocomplete,DateRangeOption,IsShowNegateButton) VALUES (200484,0,0,'Y',TO_TIMESTAMP('2024-12-10 11:06:44','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-12-10 11:06:44','YYYY-MM-DD HH24:MI:SS'),100,'Document Type','Document type or rules','The Document Type determines document sequence and processing rules',142,20,19,'N',52054,0,'N','C_DocType_ID','Y','D',196,'2b9ac743-0893-474a-aa96-c1eafe8fba86','N','N','D','N') +; + diff --git a/migration/iD11/postgresql/202412101102_IDEMPIERE-6335.sql b/migration/iD11/postgresql/202412101102_IDEMPIERE-6335.sql new file mode 100644 index 0000000000..2fb5a6ed5b --- /dev/null +++ b/migration/iD11/postgresql/202412101102_IDEMPIERE-6335.sql @@ -0,0 +1,7 @@ +-- IDEMPIERE-6335 +SELECT register_migration_script('202412101102_IDEMPIERE-6335.sql') FROM dual; + +-- Dec 10, 2024, 11:06:45 AM BRT +INSERT INTO AD_Process_Para (AD_Process_Para_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,AD_Process_ID,SeqNo,AD_Reference_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted,IsAutocomplete,DateRangeOption,IsShowNegateButton) VALUES (200484,0,0,'Y',TO_TIMESTAMP('2024-12-10 11:06:44','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2024-12-10 11:06:44','YYYY-MM-DD HH24:MI:SS'),100,'Document Type','Document type or rules','The Document Type determines document sequence and processing rules',142,20,19,'N',52054,0,'N','C_DocType_ID','Y','D',196,'2b9ac743-0893-474a-aa96-c1eafe8fba86','N','N','D','N') +; + diff --git a/org.adempiere.base.process/src/org/compiere/process/InvoiceCreateInOut.java b/org.adempiere.base.process/src/org/compiere/process/InvoiceCreateInOut.java index 78eea6d754..1f1a3ee1b7 100644 --- a/org.adempiere.base.process/src/org/compiere/process/InvoiceCreateInOut.java +++ b/org.adempiere.base.process/src/org/compiere/process/InvoiceCreateInOut.java @@ -42,6 +42,7 @@ import org.compiere.util.Env; public class InvoiceCreateInOut extends SvrProcess { public static final String PARAM_M_Warehouse_ID = MInOut.COLUMNNAME_M_Warehouse_ID; + public static final String PARAM_C_DocType_ID = MInOut.COLUMNNAME_C_DocType_ID; /** Warehouse */ private int p_M_Warehouse_ID = 0; @@ -49,7 +50,9 @@ public class InvoiceCreateInOut extends SvrProcess private int p_C_Invoice_ID = 0; /** Receipt */ private MInOut m_inout = null; - + /** Document Type */ + private int p_C_DocType_ID = 0; + /** * Prepare - e.g., get Parameters. */ @@ -62,6 +65,8 @@ public class InvoiceCreateInOut extends SvrProcess ; else if (name.equals(PARAM_M_Warehouse_ID)) p_M_Warehouse_ID = para.getParameterAsInt(); + else if (name.equals(PARAM_C_DocType_ID)) + p_C_DocType_ID = para.getParameterAsInt(); else MProcessPara.validateUnknownParameter(getProcessInfo().getAD_Process_ID(), para); } @@ -110,6 +115,8 @@ public class InvoiceCreateInOut extends SvrProcess if (m_inout != null) return m_inout; m_inout = new MInOut (invoice, 0, null, p_M_Warehouse_ID); + if (p_C_DocType_ID != 0) + m_inout.setC_DocType_ID(p_C_DocType_ID); m_inout.saveEx(); return m_inout; }