diff --git a/migration/i5.1/oracle/201805200007_IDEMPIERE-3716.sql b/migration/i5.1/oracle/201805200007_IDEMPIERE-3716.sql new file mode 100644 index 0000000000..5f2dae28e3 --- /dev/null +++ b/migration/i5.1/oracle/201805200007_IDEMPIERE-3716.sql @@ -0,0 +1,16 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- May 19, 2018 11:01:06 PM CEST +-- IDEMPIERE-3716 Extend the length of the Column SQL field in AD_ViewColumn to allow more advanced queries +UPDATE AD_Column SET FieldLength=2000,Updated=TO_DATE('2018-05-19 23:01:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=210586 +; + +-- May 19, 2018 11:01:08 PM CEST +ALTER TABLE AD_ViewColumn ADD Tmp_ColumnSQL VARCHAR2(2000) DEFAULT NULL; +UPDATE AD_ViewColumn SET Tmp_ColumnSQL = ColumnSQL; +ALTER TABLE AD_ViewColumn DROP COLUMN ColumnSQL; +ALTER TABLE AD_ViewColumn RENAME COLUMN Tmp_ColumnSQL TO ColumnSQL; + +SELECT register_migration_script('201805200007_IDEMPIERE-3716.sql') FROM dual +; diff --git a/migration/i5.1/oracle/201805221532_IDEMPIERE-918.sql b/migration/i5.1/oracle/201805221532_IDEMPIERE-918.sql new file mode 100644 index 0000000000..1bc6b1560f --- /dev/null +++ b/migration/i5.1/oracle/201805221532_IDEMPIERE-918.sql @@ -0,0 +1,51 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-918 +-- May 22, 2018 3:17:13 PM CEST +INSERT INTO AD_Process (AD_Process_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,IsReport,Value,IsDirectPrint,Classname,AccessLevel,EntityType,Statistic_Count,Statistic_Seconds,IsBetaFunctionality,IsServerProcess,ShowHelp,CopyFromProcess,AD_Process_UU) VALUES (200100,0,0,'Y',TO_DATE('2018-05-22 15:17:13','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-05-22 15:17:13','YYYY-MM-DD HH24:MI:SS'),100,'Create Credit Memo','Creates a credit memo based on the invoice.','The invoice should be correct and completed.','N','InvoiceCreateCreditMemo','N','org.idempiere.process.InvoiceCreateCreditMemo','1','D',0,0,'N','N','Y','N','68540275-9c56-4e1b-99f5-d155eb62a12b') +; + +-- May 22, 2018 3:22:56 PM CEST +INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Description,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200118,'C_DocTypeTarget AR/AP Credit Memos','Target Document Type AR/AP Credit Memos','S','C_DocType.DocBaseType IN (''ARC'',''APC'') AND C_DocType.IsSOTrx=''@IsSOTrx@'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@',0,0,'Y',TO_DATE('2018-05-22 15:22:56','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-05-22 15:22:56','YYYY-MM-DD HH24:MI:SS'),100,'D','b27e8ab7-8128-43b2-b94d-175c3f77e4cf') +; + +-- May 22, 2018 3:24:44 PM CEST +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) VALUES (200228,0,0,'Y',TO_DATE('2018-05-22 15:24:44','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-05-22 15:24:44','YYYY-MM-DD HH24:MI:SS'),100,'Document Type','Document type or rules','The Document Type determines document sequence and processing rules',200100,10,19,'N',200118,10,'Y','C_DocType_ID','Y','D',196,'0022f86c-0629-4d70-84c3-cc6a506fdf7c','N') +; + +-- May 22, 2018 3:28:49 PM CEST +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,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200229,0,0,'Y',TO_DATE('2018-05-22 15:28:49','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-05-22 15:28:49','YYYY-MM-DD HH24:MI:SS'),100,'Date Invoiced','Date printed on Invoice','The Date Invoice indicates the date printed on the invoice.',200100,20,15,'N',10,'Y','@#Date@','DateInvoiced','Y','D',267,'0c954e16-967b-4b48-9075-8a134b72e2d2','N') +; + +-- May 22, 2018 3:29:12 PM CEST +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,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200230,0,0,'Y',TO_DATE('2018-05-22 15:29:12','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-05-22 15:29:12','YYYY-MM-DD HH24:MI:SS'),100,'Account Date','Accounting Date','The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.',200100,30,15,'N',10,'Y','@#Date@','DateAcct','Y','D',263,'4edbbf7b-c6d3-4b3d-84b7-1591c204b91d','N') +; + +-- May 22, 2018 3:30:49 PM CEST +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,AD_Reference_Value_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200231,0,0,'Y',TO_DATE('2018-05-22 15:30:49','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-05-22 15:30:49','YYYY-MM-DD HH24:MI:SS'),100,'Document Action','The targeted status of the document','You find the current status in the Document Status field. The options are listed in a popup',200100,40,17,135,'N',219,0,'N','DocAction','Y','D',287,'ce0b15c4-5e79-4dfd-b11b-0992911df4b4','N') +; + +-- May 22, 2018 3:32:01 PM CEST +INSERT INTO AD_ToolBarButton (AD_Client_ID,AD_Org_ID,Created,CreatedBy,ComponentName,IsActive,AD_ToolBarButton_ID,Name,Updated,UpdatedBy,IsCustomization,AD_ToolBarButton_UU,Action,AD_Tab_ID,AD_Process_ID,DisplayLogic,SeqNo) VALUES (0,0,TO_DATE('2018-05-22 15:32:01','YYYY-MM-DD HH24:MI:SS'),100,'InvoiceCustomerCreateCreditMemo','Y',200096,'InvoiceCustomerCreateCreditMemo',TO_DATE('2018-05-22 15:32:01','YYYY-MM-DD HH24:MI:SS'),100,'N','ebf24687-2124-496b-89ee-5d75e05743a3','W',263,200100,'@DocStatus@=''CO'' | @DocStatus@=''CL''',10) +; + +-- May 22, 2018 3:32:35 PM CEST +INSERT INTO AD_ToolBarButton (AD_Client_ID,AD_Org_ID,Created,CreatedBy,ComponentName,IsActive,AD_ToolBarButton_ID,Name,Updated,UpdatedBy,IsCustomization,AD_ToolBarButton_UU,Action,AD_Tab_ID,AD_Process_ID,DisplayLogic,SeqNo) VALUES (0,0,TO_DATE('2018-05-22 15:32:34','YYYY-MM-DD HH24:MI:SS'),100,'InvoiceVendorCreateCreditMemo','Y',200097,'InvoiceVendorCreateCreditMemo',TO_DATE('2018-05-22 15:32:34','YYYY-MM-DD HH24:MI:SS'),100,'N','2e2c53e9-4e1e-4789-8caf-c772e601e107','W',290,200100,'@DocStatus@=''CO'' | @DocStatus@=''CL''',10) +; + +-- May 22, 2018 7:25:46 PM CEST +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Invoice has already allocations',0,0,'Y',TO_DATE('2018-05-22 19:25:46','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-05-22 19:25:46','YYYY-MM-DD HH24:MI:SS'),100,200471,'InvoiceHasAllocations','D','f0dc5362-437e-4fd9-bdc9-c8b472678765') +; + +-- May 22, 2018 7:26:13 PM CEST +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Cannot create a credit memo from a credit memo',0,0,'Y',TO_DATE('2018-05-22 19:26:13','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-05-22 19:26:13','YYYY-MM-DD HH24:MI:SS'),100,200472,'CannotCreateCreditMemoFromCreditMemo','D','36370a38-ec58-4e1f-8804-e869a17730ac') +; + +-- May 22, 2018 7:26:37 PM CEST +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Credit Memo already exists',0,0,'Y',TO_DATE('2018-05-22 19:26:37','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-05-22 19:26:37','YYYY-MM-DD HH24:MI:SS'),100,200473,'CreditMemoAlreadyExists','D','c67e63fc-4a41-45dc-b52c-317688b125d2') +; + +SELECT register_migration_script('201805221532_IDEMPIERE-918.sql') FROM dual +; + diff --git a/migration/i5.1/postgresql/201805200007_IDEMPIERE-3716.sql b/migration/i5.1/postgresql/201805200007_IDEMPIERE-3716.sql new file mode 100644 index 0000000000..619204a22b --- /dev/null +++ b/migration/i5.1/postgresql/201805200007_IDEMPIERE-3716.sql @@ -0,0 +1,11 @@ +-- May 19, 2018 11:01:06 PM CEST +-- IDEMPIERE-3716 Extend the length of the Column SQL field in AD_ViewColumn to allow more advanced queries +UPDATE AD_Column SET FieldLength=2000,Updated=TO_TIMESTAMP('2018-05-19 23:01:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=210586 +; + +-- May 21, 2018 1:37:18 PM CEST +INSERT INTO t_alter_column values('ad_viewcolumn','ColumnSQL','VARCHAR(2000)',null,'NULL') +; + +SELECT register_migration_script('201805200007_IDEMPIERE-3716.sql') FROM dual +; diff --git a/migration/i5.1/postgresql/201805221532_IDEMPIERE-918.sql b/migration/i5.1/postgresql/201805221532_IDEMPIERE-918.sql new file mode 100644 index 0000000000..e074f1617f --- /dev/null +++ b/migration/i5.1/postgresql/201805221532_IDEMPIERE-918.sql @@ -0,0 +1,48 @@ +-- IDEMPIERE-918 +-- May 22, 2018 3:17:13 PM CEST +INSERT INTO AD_Process (AD_Process_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,Name,Description,Help,IsReport,Value,IsDirectPrint,Classname,AccessLevel,EntityType,Statistic_Count,Statistic_Seconds,IsBetaFunctionality,IsServerProcess,ShowHelp,CopyFromProcess,AD_Process_UU) VALUES (200100,0,0,'Y',TO_TIMESTAMP('2018-05-22 15:17:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-05-22 15:17:13','YYYY-MM-DD HH24:MI:SS'),100,'Create Credit Memo','Creates a credit memo based on the invoice.','The invoice should be correct and completed.','N','InvoiceCreateCreditMemo','N','org.idempiere.process.InvoiceCreateCreditMemo','1','D',0,0,'N','N','Y','N','68540275-9c56-4e1b-99f5-d155eb62a12b') +; + +-- May 22, 2018 3:22:56 PM CEST +INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Description,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200118,'C_DocTypeTarget AR/AP Credit Memos','Target Document Type AR/AP Credit Memos','S','C_DocType.DocBaseType IN (''ARC'',''APC'') AND C_DocType.IsSOTrx=''@IsSOTrx@'' AND C_DocType.AD_Client_ID=@#AD_Client_ID@',0,0,'Y',TO_TIMESTAMP('2018-05-22 15:22:56','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-05-22 15:22:56','YYYY-MM-DD HH24:MI:SS'),100,'D','b27e8ab7-8128-43b2-b94d-175c3f77e4cf') +; + +-- May 22, 2018 3:24:44 PM CEST +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) VALUES (200228,0,0,'Y',TO_TIMESTAMP('2018-05-22 15:24:44','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-05-22 15:24:44','YYYY-MM-DD HH24:MI:SS'),100,'Document Type','Document type or rules','The Document Type determines document sequence and processing rules',200100,10,19,'N',200118,10,'Y','C_DocType_ID','Y','D',196,'0022f86c-0629-4d70-84c3-cc6a506fdf7c','N') +; + +-- May 22, 2018 3:28:49 PM CEST +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,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200229,0,0,'Y',TO_TIMESTAMP('2018-05-22 15:28:49','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-05-22 15:28:49','YYYY-MM-DD HH24:MI:SS'),100,'Date Invoiced','Date printed on Invoice','The Date Invoice indicates the date printed on the invoice.',200100,20,15,'N',10,'Y','@#Date@','DateInvoiced','Y','D',267,'0c954e16-967b-4b48-9075-8a134b72e2d2','N') +; + +-- May 22, 2018 3:29:12 PM CEST +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,FieldLength,IsMandatory,DefaultValue,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200230,0,0,'Y',TO_TIMESTAMP('2018-05-22 15:29:12','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-05-22 15:29:12','YYYY-MM-DD HH24:MI:SS'),100,'Account Date','Accounting Date','The Accounting Date indicates the date to be used on the General Ledger account entries generated from this document. It is also used for any currency conversion.',200100,30,15,'N',10,'Y','@#Date@','DateAcct','Y','D',263,'4edbbf7b-c6d3-4b3d-84b7-1591c204b91d','N') +; + +-- May 22, 2018 3:30:49 PM CEST +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,AD_Reference_Value_ID,IsRange,AD_Val_Rule_ID,FieldLength,IsMandatory,ColumnName,IsCentrallyMaintained,EntityType,AD_Element_ID,AD_Process_Para_UU,IsEncrypted) VALUES (200231,0,0,'Y',TO_TIMESTAMP('2018-05-22 15:30:49','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-05-22 15:30:49','YYYY-MM-DD HH24:MI:SS'),100,'Document Action','The targeted status of the document','You find the current status in the Document Status field. The options are listed in a popup',200100,40,17,135,'N',219,0,'N','DocAction','Y','D',287,'ce0b15c4-5e79-4dfd-b11b-0992911df4b4','N') +; + +-- May 22, 2018 3:32:01 PM CEST +INSERT INTO AD_ToolBarButton (AD_Client_ID,AD_Org_ID,Created,CreatedBy,ComponentName,IsActive,AD_ToolBarButton_ID,Name,Updated,UpdatedBy,IsCustomization,AD_ToolBarButton_UU,"action",AD_Tab_ID,AD_Process_ID,DisplayLogic,SeqNo) VALUES (0,0,TO_TIMESTAMP('2018-05-22 15:32:01','YYYY-MM-DD HH24:MI:SS'),100,'InvoiceCustomerCreateCreditMemo','Y',200096,'InvoiceCustomerCreateCreditMemo',TO_TIMESTAMP('2018-05-22 15:32:01','YYYY-MM-DD HH24:MI:SS'),100,'N','ebf24687-2124-496b-89ee-5d75e05743a3','W',263,200100,'@DocStatus@=''CO'' | @DocStatus@=''CL''',10) +; + +-- May 22, 2018 3:32:35 PM CEST +INSERT INTO AD_ToolBarButton (AD_Client_ID,AD_Org_ID,Created,CreatedBy,ComponentName,IsActive,AD_ToolBarButton_ID,Name,Updated,UpdatedBy,IsCustomization,AD_ToolBarButton_UU,"action",AD_Tab_ID,AD_Process_ID,DisplayLogic,SeqNo) VALUES (0,0,TO_TIMESTAMP('2018-05-22 15:32:34','YYYY-MM-DD HH24:MI:SS'),100,'InvoiceVendorCreateCreditMemo','Y',200097,'InvoiceVendorCreateCreditMemo',TO_TIMESTAMP('2018-05-22 15:32:34','YYYY-MM-DD HH24:MI:SS'),100,'N','2e2c53e9-4e1e-4789-8caf-c772e601e107','W',290,200100,'@DocStatus@=''CO'' | @DocStatus@=''CL''',10) +; + +-- May 22, 2018 7:25:46 PM CEST +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Invoice has already allocations',0,0,'Y',TO_TIMESTAMP('2018-05-22 19:25:46','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-05-22 19:25:46','YYYY-MM-DD HH24:MI:SS'),100,200471,'InvoiceHasAllocations','D','f0dc5362-437e-4fd9-bdc9-c8b472678765') +; + +-- May 22, 2018 7:26:13 PM CEST +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Cannot create a credit memo from a credit memo',0,0,'Y',TO_TIMESTAMP('2018-05-22 19:26:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-05-22 19:26:13','YYYY-MM-DD HH24:MI:SS'),100,200472,'CannotCreateCreditMemoFromCreditMemo','D','36370a38-ec58-4e1f-8804-e869a17730ac') +; + +-- May 22, 2018 7:26:37 PM CEST +INSERT INTO AD_Message (MsgType,MsgText,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Message_ID,Value,EntityType,AD_Message_UU) VALUES ('E','Credit Memo already exists',0,0,'Y',TO_TIMESTAMP('2018-05-22 19:26:37','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-05-22 19:26:37','YYYY-MM-DD HH24:MI:SS'),100,200473,'CreditMemoAlreadyExists','D','c67e63fc-4a41-45dc-b52c-317688b125d2') +; + +SELECT register_migration_script('201805221532_IDEMPIERE-918.sql') FROM dual +; + diff --git a/org.adempiere.base.process/src/org/compiere/process/ImportInvoice.java b/org.adempiere.base.process/src/org/compiere/process/ImportInvoice.java index efd6608de1..9da59775f0 100644 --- a/org.adempiere.base.process/src/org/compiere/process/ImportInvoice.java +++ b/org.adempiere.base.process/src/org/compiere/process/ImportInvoice.java @@ -655,7 +655,7 @@ public class ImportInvoice extends SvrProcess int lineNo = 0; while (rs.next ()) { - X_I_Invoice imp = new X_I_Invoice (getCtx (), rs, null); + X_I_Invoice imp = new X_I_Invoice (getCtx (), rs, get_TrxName()); String cmpDocumentNo = imp.getDocumentNo(); if (cmpDocumentNo == null) cmpDocumentNo = ""; @@ -680,7 +680,7 @@ public class ImportInvoice extends SvrProcess if (oldDocumentNo == null) oldDocumentNo = ""; // - invoice = new MInvoice (getCtx(), 0, null); + invoice = new MInvoice (getCtx(), 0, get_TrxName()); invoice.setClientOrg (imp.getAD_Client_ID(), imp.getAD_Org_ID()); invoice.setC_DocTypeTarget_ID(imp.getC_DocType_ID()); invoice.setIsSOTrx(imp.isSOTrx()); diff --git a/org.adempiere.base.process/src/org/idempiere/process/InvoiceCreateCreditMemo.java b/org.adempiere.base.process/src/org/idempiere/process/InvoiceCreateCreditMemo.java new file mode 100644 index 0000000000..6654076b90 --- /dev/null +++ b/org.adempiere.base.process/src/org/idempiere/process/InvoiceCreateCreditMemo.java @@ -0,0 +1,222 @@ +/*********************************************************************** + * This file is part of iDempiere ERP Open Source * + * http://www.idempiere.org * + * * + * Copyright (C) Contributors * + * * + * This program is free software; you can redistribute it and/or * + * modify it under the terms of the GNU General Public License * + * as published by the Free Software Foundation; either version 2 * + * of the License, or (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * + * MA 02110-1301, USA. * + * * + * Contributors: * + * - Carlos Ruiz * + **********************************************************************/ +package org.idempiere.process; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.logging.Level; + +import org.adempiere.exceptions.AdempiereException; +import org.compiere.model.MAllocationHdr; +import org.compiere.model.MAllocationLine; +import org.compiere.model.MDocType; +import org.compiere.model.MInvoice; +import org.compiere.model.MInvoiceLine; +import org.compiere.model.MPeriod; +import org.compiere.process.DocAction; +import org.compiere.process.ProcessInfoParameter; +import org.compiere.process.SvrProcess; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.Msg; + +/** + * IDEMPIERE-918 Generate credit memo from invoice + * @author Carlos Ruiz - globalqss + */ +public class InvoiceCreateCreditMemo extends SvrProcess { + /* The document type for the credit memo */ + private int p_C_DocType_ID = 0; + /* Invoice Date */ + private Timestamp p_DateInvoiced = null; + /* Accounting Date */ + private Timestamp p_DateAcct = null; + /* Document Action */ + private String p_DocAction = null; + /* Create allocation between the invoice and the credit memo */ + private boolean p_IsCreateAllocation = false; + /* The invoice being credited */ + private MInvoice invoice = null; + + /** + * Prepare - e.g., get Parameters. + */ + protected void prepare() { + for (ProcessInfoParameter para : getParameter()) { + String name = para.getParameterName(); + switch (name) { + case "C_DocType_ID": + p_C_DocType_ID = para.getParameterAsInt(); + break; + case "DateInvoiced": + p_DateInvoiced = para.getParameterAsTimestamp(); + break; + case "DateAcct": + p_DateAcct = para.getParameterAsTimestamp(); + break; + case "DocAction": + p_DocAction = para.getParameterAsString(); + break; + case "IsCreateAllocation": + p_IsCreateAllocation = para.getParameterAsBoolean(); + break; + default: + log.log(Level.SEVERE, "Unknown Parameter: " + name); + } + } + invoice = new MInvoice(getCtx(), getRecord_ID(), get_TrxName()); + } // prepare + + /** + * Perform process. + * @return Message + * @throws Exception + */ + protected String doIt() throws Exception { + if (log.isLoggable(Level.INFO)) log.info("C_Invoice_ID" + invoice.getC_Invoice_ID() + ", C_DocType_ID=" + p_C_DocType_ID + ", DateInvoiced=" + p_DateInvoiced + + ", DateAcct=" + p_DateAcct + ", DocAction=" + p_DocAction); + + if (p_IsCreateAllocation) { + // validate - cannot create allocation if the invoice is already paid or partially paid + MAllocationHdr[] allocs = MAllocationHdr.getOfInvoice(getCtx(), invoice.getC_Invoice_ID(), get_TrxName()); + if (allocs.length > 0) { + throw new AdempiereException(Msg.getMsg(getCtx(), "InvoiceHasAllocations")); + } + } + // validate just for invoices, not for credit memos + if (invoice.isCreditMemo()) { + throw new AdempiereException(Msg.getMsg(getCtx(), "CannotCreateCreditMemoFromCreditMemo")); + } + // Validate if there is already another credit memo for this invoice (via POReference) + final String sql = "" + + "SELECT C_Invoice_ID " + + "FROM C_Invoice i " + + " JOIN C_DocType dt ON ( i.C_DocType_ID = dt.C_DocType_ID ) " + + "WHERE i.POReference = ? " + + " AND dt.DocBaseType IN ( ?, ? ) " + + " AND i.C_BPartner_ID = ? " + + " AND i.AD_Client_ID = ? " + + " AND i.AD_Org_ID = ?"; + int id = DB.getSQLValue(get_TrxName(), sql, + invoice.getDocumentNo(), + MDocType.DOCBASETYPE_APCreditMemo, MDocType.DOCBASETYPE_ARCreditMemo, + invoice.getC_BPartner_ID(), + invoice.getAD_Client_ID(), invoice.getAD_Org_ID()); + if (id > 0) { + MInvoice actualCreditMemo = MInvoice.get(getCtx(), id); + MDocType dtc = MDocType.get(getCtx(), actualCreditMemo.getC_DocTypeTarget_ID()); + addLog(0, null, null, dtc.getName() + " " + actualCreditMemo.getDocumentNo(), MInvoice.Table_ID, actualCreditMemo.getC_Invoice_ID()); + throw new AdempiereException(Msg.getMsg(getCtx(), "CreditMemoAlreadyExists")); + } + + MInvoice creditMemo = credit(); + if (creditMemo != null) { + MDocType dtc = MDocType.get(getCtx(), creditMemo.getC_DocTypeTarget_ID()); + addLog(0, null, null, dtc.getName() + " " + creditMemo.getDocumentNo(), MInvoice.Table_ID, creditMemo.getC_Invoice_ID()); + } + + return "@OK@"; + } // doIt + + private MInvoice credit() { + Timestamp creditDate = p_DateAcct; + Timestamp creditDateInvoiced = p_DateInvoiced; + MPeriod.testPeriodOpen(getCtx(), creditDate, p_C_DocType_ID, invoice.getAD_Org_ID()); + + // Deep Copy + MInvoice creditMemo = null; + creditMemo = MInvoice.copyFrom(invoice, creditDateInvoiced, creditDate, p_C_DocType_ID, invoice.isSOTrx(), false, get_TrxName(), true); + if (creditMemo == null) { + throw new AdempiereException("Could not create Credit Memo"); + } + + // Reverse Line Qty + MInvoiceLine[] oLines = invoice.getLines(false); + MInvoiceLine[] rLines = creditMemo.getLines(true); + if (oLines.length != rLines.length) { + throw new AdempiereException("Credit Memo created with different number of lines than invoice"); + } + for (int i = 0; i < rLines.length; i++) { + MInvoiceLine rLine = rLines[i]; + MInvoiceLine oLine = oLines[i]; + rLine.setQtyEntered(oLine.getQtyEntered()); + rLine.setQtyInvoiced(oLine.getQtyInvoiced()); + rLine.setLineNetAmt(oLine.getLineNetAmt()); + rLine.setTaxAmt(oLine.getTaxAmt()); + rLine.setLineTotalAmt(oLine.getLineTotalAmt()); + rLine.setPriceActual(oLine.getPriceActual()); + rLine.setPriceList(oLine.getPriceList()); + rLine.setPriceLimit(oLine.getPriceLimit()); + rLine.setPriceEntered(oLine.getPriceEntered()); + rLine.setC_UOM_ID(oLine.getC_UOM_ID()); + if (!rLine.save(get_TrxName())) { + throw new AdempiereException("Could not create credit memo line"); + } + } + if (MInvoice.PAYMENTRULE_Cash.equals(creditMemo.getPaymentRule())) { + creditMemo.setPaymentRule(MInvoice.PAYMENTRULE_OnCredit); // avoid creation of automatic payment + } + creditMemo.setC_Order_ID(invoice.getC_Order_ID()); + StringBuilder msgadd = new StringBuilder("{->").append(invoice.getDocumentNo()).append(")"); + creditMemo.addDescription(msgadd.toString()); + creditMemo.setPOReference(invoice.getDocumentNo()); + creditMemo.saveEx(get_TrxName()); + // + if (p_DocAction != null) { + if (!creditMemo.processIt(p_DocAction)) { + throw new AdempiereException("ERROR processing credit memo " + p_DocAction + " -> " + creditMemo.getProcessMsg()); + } + if (p_IsCreateAllocation && DocAction.ACTION_Complete.equals(p_DocAction)) { + // Create Allocation + StringBuilder msgall = new StringBuilder().append(Msg.translate(getCtx(), "C_Invoice_ID")).append(": ").append(invoice.getDocumentNo()).append("/").append(creditMemo.getDocumentNo()); + MAllocationHdr alloc = new MAllocationHdr(getCtx(), false, creditDate, + invoice.getC_Currency_ID(), + msgall.toString(), + get_TrxName()); + alloc.setAD_Org_ID(invoice.getAD_Org_ID()); + alloc.saveEx(); + // Amount + BigDecimal gt = invoice.getGrandTotal(true); + if (!invoice.isSOTrx()) + gt = gt.negate(); + // Invoice Line + MAllocationLine aLine = new MAllocationLine (alloc, gt, Env.ZERO, Env.ZERO, Env.ZERO); + aLine.setC_Invoice_ID(invoice.getC_Invoice_ID()); + aLine.saveEx(); + // Credit Line + MAllocationLine cLine = new MAllocationLine (alloc, gt.negate(), Env.ZERO, Env.ZERO, Env.ZERO); + cLine.setC_Invoice_ID(creditMemo.getC_Invoice_ID()); + cLine.saveEx(); + if (!alloc.processIt(DocAction.ACTION_Complete)) + throw new AdempiereException("Failed when processing document - " + alloc.getProcessMsg()); + // end added + alloc.saveEx(); + } + } + + return creditMemo; + } + +} // InvoiceCreateCreditMemo diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_Payment.java b/org.adempiere.base/src/org/compiere/acct/Doc_Payment.java index 2d598d3b17..558d5d8071 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_Payment.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_Payment.java @@ -171,20 +171,22 @@ public class Doc_Payment extends Doc // Avoid usage of clearing accounts // If both accounts and orgs are the same then remove the posting - MAccount acct_dr = dr.getAccount(); - MAccount acct_cr = cr.getAccount(); - int org_dr = dr.getAD_Org_ID(); - int org_cr = cr.getAD_Org_ID(); - if (!as.isPostIfClearingEqual() && acct_dr!=null && acct_dr.equals(acct_cr) && org_dr == org_cr) { + if (dr != null && cr != null) { + MAccount acct_dr = dr.getAccount(); + MAccount acct_cr = cr.getAccount(); + int org_dr = dr.getAD_Org_ID(); + int org_cr = cr.getAD_Org_ID(); + if (!as.isPostIfClearingEqual() && acct_dr!=null && acct_dr.equals(acct_cr) && org_dr == org_cr) { - BigDecimal debit = dr.getAmtSourceDr(); - BigDecimal credit = cr.getAmtSourceCr(); + BigDecimal debit = dr.getAmtSourceDr(); + BigDecimal credit = cr.getAmtSourceCr(); + + if (debit.compareTo(credit) == 0) { + fact.remove(dr); + fact.remove(cr); + } - if (debit.compareTo(credit) == 0) { - fact.remove(dr); - fact.remove(cr); } - } // End Avoid usage of clearing accounts // diff --git a/org.adempiere.base/src/org/compiere/model/MInOut.java b/org.adempiere.base/src/org/compiere/model/MInOut.java index 8bdf013211..d02e7ea254 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOut.java +++ b/org.adempiere.base/src/org/compiere/model/MInOut.java @@ -38,6 +38,7 @@ import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.compiere.util.TimeUtil; /** * Shipment Model @@ -1780,7 +1781,7 @@ public class MInOut extends X_M_InOut implements DocAction protected void setDefiniteDocumentNo() { MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); if (dt.isOverwriteDateOnComplete()) { - setMovementDate(new Timestamp (System.currentTimeMillis())); + setMovementDate(TimeUtil.getDay(0)); if (getDateAcct().before(getMovementDate())) { setDateAcct(getMovementDate()); MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID()); diff --git a/org.adempiere.base/src/org/compiere/model/MInOutLine.java b/org.adempiere.base/src/org/compiere/model/MInOutLine.java index d20e0b66bc..b79c2a8d5b 100644 --- a/org.adempiere.base/src/org/compiere/model/MInOutLine.java +++ b/org.adempiere.base/src/org/compiere/model/MInOutLine.java @@ -578,7 +578,9 @@ public class MInOutLine extends X_M_InOutLine } } - I_M_AttributeSet attributeset = MProduct.get(getCtx(), getM_Product_ID()).getM_AttributeSet(); + I_M_AttributeSet attributeset = null; + if (getM_Product_ID() > 0) + attributeset = MProduct.get(getCtx(), getM_Product_ID()).getM_AttributeSet(); boolean isAutoGenerateLot = false; if (attributeset != null) isAutoGenerateLot = attributeset.isAutoGenerateLot(); diff --git a/org.adempiere.base/src/org/compiere/model/MInventory.java b/org.adempiere.base/src/org/compiere/model/MInventory.java index a57288f670..9260da7dd7 100644 --- a/org.adempiere.base/src/org/compiere/model/MInventory.java +++ b/org.adempiere.base/src/org/compiere/model/MInventory.java @@ -33,6 +33,7 @@ import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.compiere.util.TimeUtil; import org.compiere.util.Util; /** @@ -658,7 +659,7 @@ public class MInventory extends X_M_Inventory implements DocAction private void setDefiniteDocumentNo() { MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); if (dt.isOverwriteDateOnComplete()) { - setMovementDate(new Timestamp (System.currentTimeMillis())); + setMovementDate(TimeUtil.getDay(0)); MPeriod.testPeriodOpen(getCtx(), getMovementDate(), MDocType.DOCBASETYPE_MaterialPhysicalInventory, getAD_Org_ID()); } if (dt.isOverwriteSeqOnComplete()) { diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java index 8fe61c279f..aa53bdc5a5 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoice.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoice.java @@ -45,6 +45,7 @@ import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.compiere.util.TimeUtil; /** @@ -2152,7 +2153,7 @@ public class MInvoice extends X_C_Invoice implements DocAction return; MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); if (dt.isOverwriteDateOnComplete()) { - setDateInvoiced(new Timestamp (System.currentTimeMillis())); + setDateInvoiced(TimeUtil.getDay(0)); if (getDateAcct().before(getDateInvoiced())) { setDateAcct(getDateInvoiced()); MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID()); diff --git a/org.adempiere.base/src/org/compiere/model/MJournal.java b/org.adempiere.base/src/org/compiere/model/MJournal.java index 8b098ff85c..24b00150a0 100644 --- a/org.adempiere.base/src/org/compiere/model/MJournal.java +++ b/org.adempiere.base/src/org/compiere/model/MJournal.java @@ -29,6 +29,7 @@ import org.compiere.process.DocumentEngine; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.compiere.util.TimeUtil; /** * GL Journal Model @@ -631,7 +632,7 @@ public class MJournal extends X_GL_Journal implements DocAction MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); if (dt.isOverwriteDateOnComplete()) { if (this.getProcessedOn().signum() == 0) { - setDateDoc(new Timestamp (System.currentTimeMillis())); + setDateDoc(TimeUtil.getDay(0)); if (getDateAcct().before(getDateDoc())) { setDateAcct(getDateDoc()); MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID()); diff --git a/org.adempiere.base/src/org/compiere/model/MJournalBatch.java b/org.adempiere.base/src/org/compiere/model/MJournalBatch.java index 03f76d1923..493a4167c9 100644 --- a/org.adempiere.base/src/org/compiere/model/MJournalBatch.java +++ b/org.adempiere.base/src/org/compiere/model/MJournalBatch.java @@ -32,6 +32,7 @@ import org.compiere.process.DocumentEngine; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.compiere.util.TimeUtil; /** * Journal Batch Model @@ -509,7 +510,7 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction private void setDefiniteDocumentNo() { MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); if (dt.isOverwriteDateOnComplete()) { - setDateDoc(new Timestamp (System.currentTimeMillis())); + setDateDoc(TimeUtil.getDay(0)); if (getDateAcct().before(getDateDoc())) { setDateAcct(getDateDoc()); MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID()); diff --git a/org.adempiere.base/src/org/compiere/model/MMovement.java b/org.adempiere.base/src/org/compiere/model/MMovement.java index 9b23f2d412..297c9ec714 100644 --- a/org.adempiere.base/src/org/compiere/model/MMovement.java +++ b/org.adempiere.base/src/org/compiere/model/MMovement.java @@ -32,6 +32,7 @@ import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.compiere.util.TimeUtil; /** * Inventory Movement Model @@ -631,7 +632,7 @@ public class MMovement extends X_M_Movement implements DocAction private void setDefiniteDocumentNo() { MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); if (dt.isOverwriteDateOnComplete()) { - setMovementDate(new Timestamp (System.currentTimeMillis())); + setMovementDate(TimeUtil.getDay(0)); MPeriod.testPeriodOpen(getCtx(), getMovementDate(), getC_DocType_ID(), getAD_Org_ID()); } if (dt.isOverwriteSeqOnComplete()) { diff --git a/org.adempiere.base/src/org/compiere/model/MOrder.java b/org.adempiere.base/src/org/compiere/model/MOrder.java index 83b3cbaa96..cfa0507cae 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrder.java +++ b/org.adempiere.base/src/org/compiere/model/MOrder.java @@ -43,6 +43,7 @@ import org.compiere.util.CLogger; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.compiere.util.TimeUtil; import org.compiere.util.Util; @@ -2125,7 +2126,7 @@ public class MOrder extends X_C_Order implements DocAction if (dt.isOverwriteDateOnComplete()) { /* a42niem - BF IDEMPIERE-63 - check if document has been completed before */ if (this.getProcessedOn().signum() == 0) { - setDateOrdered(new Timestamp (System.currentTimeMillis())); + setDateOrdered(TimeUtil.getDay(0)); if (getDateAcct().before(getDateOrdered())) { setDateAcct(getDateOrdered()); MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID()); diff --git a/org.adempiere.base/src/org/compiere/model/MPayment.java b/org.adempiere.base/src/org/compiere/model/MPayment.java index 53e730442d..cd547695e9 100644 --- a/org.adempiere.base/src/org/compiere/model/MPayment.java +++ b/org.adempiere.base/src/org/compiere/model/MPayment.java @@ -40,6 +40,7 @@ import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.IBAN; import org.compiere.util.Msg; +import org.compiere.util.TimeUtil; import org.compiere.util.Trx; import org.compiere.util.Util; import org.compiere.util.ValueNamePair; @@ -2117,7 +2118,7 @@ public class MPayment extends X_C_Payment private void setDefiniteDocumentNo() { MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); if (dt.isOverwriteDateOnComplete()) { - setDateTrx(new Timestamp (System.currentTimeMillis())); + setDateTrx(TimeUtil.getDay(0)); if (getDateAcct().before(getDateTrx())) { setDateAcct(getDateTrx()); MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID()); diff --git a/org.adempiere.base/src/org/compiere/model/MQuery.java b/org.adempiere.base/src/org/compiere/model/MQuery.java index 942a464406..6547eb66df 100644 --- a/org.adempiere.base/src/org/compiere/model/MQuery.java +++ b/org.adempiere.base/src/org/compiere/model/MQuery.java @@ -1156,8 +1156,13 @@ class Restriction implements Serializable sb.append(Operator); if ( ! (Operator.equals(MQuery.NULL) || Operator.equals(MQuery.NOT_NULL))) { - if (Code instanceof String) - sb.append(DB.TO_STRING(Code.toString())); + if (Code instanceof String) { + if (ColumnName.toUpperCase().startsWith("UPPER(")) { + sb.append("UPPER("+DB.TO_STRING(Code.toString())+")"); + } else { + sb.append(DB.TO_STRING(Code.toString())); + } + } else if (Code instanceof Timestamp) sb.append(DB.TO_DATE((Timestamp)Code, false)); else diff --git a/org.adempiere.base/src/org/compiere/model/MRequisition.java b/org.adempiere.base/src/org/compiere/model/MRequisition.java index 81d38bfeb8..ee15a69020 100644 --- a/org.adempiere.base/src/org/compiere/model/MRequisition.java +++ b/org.adempiere.base/src/org/compiere/model/MRequisition.java @@ -30,6 +30,7 @@ import org.compiere.process.DocumentEngine; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.compiere.util.TimeUtil; /** * Requisition Model @@ -364,7 +365,7 @@ public class MRequisition extends X_M_Requisition implements DocAction private void setDefiniteDocumentNo() { MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); if (dt.isOverwriteDateOnComplete()) { - setDateDoc(new Timestamp (System.currentTimeMillis())); + setDateDoc(TimeUtil.getDay(0)); MPeriod.testPeriodOpen(getCtx(), getDateDoc(), MDocType.DOCBASETYPE_PurchaseRequisition, getAD_Org_ID()); } if (dt.isOverwriteSeqOnComplete()) { diff --git a/org.adempiere.base/src/org/compiere/process/DocActionTemplate.java b/org.adempiere.base/src/org/compiere/process/DocActionTemplate.java index 1773484983..1e775a36f8 100644 --- a/org.adempiere.base/src/org/compiere/process/DocActionTemplate.java +++ b/org.adempiere.base/src/org/compiere/process/DocActionTemplate.java @@ -26,6 +26,7 @@ import org.compiere.model.ModelValidationEngine; import org.compiere.model.ModelValidator; import org.compiere.model.PO; import org.compiere.model.POInfo; +import org.compiere.util.TimeUtil; /** * Template for DocAction @@ -248,7 +249,7 @@ public class DocActionTemplate extends PO implements DocAction private void setDefiniteDocumentNo() { MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); if (dt.isOverwriteDateOnComplete()) { - setDateInvoiced(new Timestamp (System.currentTimeMillis())); + setDateInvoiced(TimeUtil.getDay(0)); if (getDateAcct().before(getDateInvoiced())) { setDateAcct(getDateInvoiced()); MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID()); diff --git a/org.adempiere.server-feature/hazelcast-template.xml b/org.adempiere.server-feature/hazelcast-template.xml index d18084f2e2..90e8c53bc0 100644 --- a/org.adempiere.server-feature/hazelcast-template.xml +++ b/org.adempiere.server-feature/hazelcast-template.xml @@ -211,6 +211,11 @@ --> INDEX-ONLY + + OBJECT + true + +