From 791623a49dbdb443d65821d09cb7df4d6e29b329 Mon Sep 17 00:00:00 2001 From: vpj-cd Date: Mon, 24 Aug 2009 22:15:36 +0000 Subject: [PATCH] Reversed invoice is create with invoice date http://sourceforge.net/tracker/?func=detail&atid=879332&aid=2839194&group_id=176962 A new method was implemented and the Account date now is a parameter the original method was deprecated kind regards Victor Perez www.e-evolution.com --- base/src/org/compiere/model/MInvoice.java | 30 ++++++++++++++++++--- base/src/org/compiere/model/MRecurring.java | 2 +- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/base/src/org/compiere/model/MInvoice.java b/base/src/org/compiere/model/MInvoice.java index 9b55bf9f24..2d8f78a8d9 100644 --- a/base/src/org/compiere/model/MInvoice.java +++ b/base/src/org/compiere/model/MInvoice.java @@ -81,6 +81,30 @@ public class MInvoice extends X_C_Invoice implements DocAction } // getOfBPartner /** + * Create new Invoice by copying + * @param from invoice + * @param dateDoc date of the document date + * @param acctDate original account date + * @param C_DocTypeTarget_ID target doc type + * @param isSOTrx sales order + * @param counter create counter links + * @param trxName trx + * @param setOrder set Order links + * @return Invoice + */ + public static MInvoice copyFrom (MInvoice from, Timestamp dateDoc, Timestamp dateAcct, + int C_DocTypeTarget_ID, boolean isSOTrx, boolean counter, + String trxName, boolean setOrder) + { + MInvoice to = copyFrom ( from, dateDoc, + C_DocTypeTarget_ID, isSOTrx, counter, + trxName, setOrder); + to.setDateAcct (dateAcct); + return to; + } + + /** + * @Deprecated * Create new Invoice by copying * @param from invoice * @param dateDoc date of the document date @@ -109,7 +133,7 @@ public class MInvoice extends X_C_Invoice implements DocAction to.setIsSOTrx(isSOTrx); // to.setDateInvoiced (dateDoc); - to.setDateAcct (from.getDateAcct()); + to.setDateAcct (dateDoc); to.setDatePrinted(null); to.setIsPrinted (false); // @@ -1879,7 +1903,7 @@ public class MInvoice extends X_C_Invoice implements DocAction } // Deep Copy - MInvoice counter = copyFrom(this, getDateInvoiced(), + MInvoice counter = copyFrom(this, getDateInvoiced(), getDateAcct(), C_DocTypeTarget_ID, !isSOTrx(), true, get_TrxName(), true); // counter.setAD_Org_ID(counterAD_Org_ID); @@ -2055,7 +2079,7 @@ public class MInvoice extends X_C_Invoice implements DocAction load(get_TrxName()); // reload allocation reversal info // Deep Copy - MInvoice reversal = copyFrom (this, getDateInvoiced(), + MInvoice reversal = copyFrom (this, getDateInvoiced(), getDateAcct(), getC_DocType_ID(), isSOTrx(), false, get_TrxName(), true); if (reversal == null) { diff --git a/base/src/org/compiere/model/MRecurring.java b/base/src/org/compiere/model/MRecurring.java index 5847db552f..493ea8e7fc 100644 --- a/base/src/org/compiere/model/MRecurring.java +++ b/base/src/org/compiere/model/MRecurring.java @@ -107,7 +107,7 @@ public class MRecurring extends X_C_Recurring else if (getRecurringType().equals(MRecurring.RECURRINGTYPE_Invoice)) { MInvoice from = new MInvoice (getCtx(), getC_Invoice_ID(), get_TrxName()); - MInvoice invoice = MInvoice.copyFrom (from, dateDoc, + MInvoice invoice = MInvoice.copyFrom (from, dateDoc, dateDoc, from.getC_DocType_ID(), from.isSOTrx(), false, get_TrxName(), false); run.setC_Invoice_ID(invoice.getC_Invoice_ID()); msg += invoice.getDocumentNo();