IDEMPIERE-2287 Overwrite Date on Complete - doesn't update dateacct

This commit is contained in:
Carlos Ruiz 2014-12-17 19:04:33 -05:00
parent 2c443e1bd5
commit 5d5f073bd5
9 changed files with 29 additions and 1 deletions

View File

@ -1752,6 +1752,10 @@ public class MInOut extends X_M_InOut implements DocAction
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
if (dt.isOverwriteDateOnComplete()) { if (dt.isOverwriteDateOnComplete()) {
setMovementDate(new Timestamp (System.currentTimeMillis())); setMovementDate(new Timestamp (System.currentTimeMillis()));
if (getDateAcct().before(getMovementDate())) {
setDateAcct(getMovementDate());
MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID());
}
} }
if (dt.isOverwriteSeqOnComplete()) { if (dt.isOverwriteSeqOnComplete()) {
String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this); String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this);

View File

@ -595,6 +595,7 @@ public class MInventory extends X_M_Inventory implements DocAction
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
if (dt.isOverwriteDateOnComplete()) { if (dt.isOverwriteDateOnComplete()) {
setMovementDate(new Timestamp (System.currentTimeMillis())); setMovementDate(new Timestamp (System.currentTimeMillis()));
MPeriod.testPeriodOpen(getCtx(), getMovementDate(), MDocType.DOCBASETYPE_MaterialPhysicalInventory, getAD_Org_ID());
} }
if (dt.isOverwriteSeqOnComplete()) { if (dt.isOverwriteSeqOnComplete()) {
String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this); String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this);

View File

@ -2118,6 +2118,10 @@ public class MInvoice extends X_C_Invoice implements DocAction
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
if (dt.isOverwriteDateOnComplete()) { if (dt.isOverwriteDateOnComplete()) {
setDateInvoiced(new Timestamp (System.currentTimeMillis())); setDateInvoiced(new Timestamp (System.currentTimeMillis()));
if (getDateAcct().before(getDateInvoiced())) {
setDateAcct(getDateInvoiced());
MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocTypeTarget_ID(), getAD_Org_ID());
}
} }
if (dt.isOverwriteSeqOnComplete()) { if (dt.isOverwriteSeqOnComplete()) {
String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this); String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this);

View File

@ -627,6 +627,10 @@ public class MJournal extends X_GL_Journal implements DocAction
if (dt.isOverwriteDateOnComplete()) { if (dt.isOverwriteDateOnComplete()) {
if (this.getProcessedOn().signum() == 0) { if (this.getProcessedOn().signum() == 0) {
setDateDoc(new Timestamp (System.currentTimeMillis())); setDateDoc(new Timestamp (System.currentTimeMillis()));
if (getDateAcct().before(getDateDoc())) {
setDateAcct(getDateDoc());
MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID());
}
} }
} }
if (dt.isOverwriteSeqOnComplete()) { if (dt.isOverwriteSeqOnComplete()) {

View File

@ -510,6 +510,10 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
if (dt.isOverwriteDateOnComplete()) { if (dt.isOverwriteDateOnComplete()) {
setDateDoc(new Timestamp (System.currentTimeMillis())); setDateDoc(new Timestamp (System.currentTimeMillis()));
if (getDateAcct().before(getDateDoc())) {
setDateAcct(getDateDoc());
MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID());
}
} }
if (dt.isOverwriteSeqOnComplete()) { if (dt.isOverwriteSeqOnComplete()) {
String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this); String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this);

View File

@ -548,6 +548,7 @@ public class MMovement extends X_M_Movement implements DocAction
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
if (dt.isOverwriteDateOnComplete()) { if (dt.isOverwriteDateOnComplete()) {
setMovementDate(new Timestamp (System.currentTimeMillis())); setMovementDate(new Timestamp (System.currentTimeMillis()));
MPeriod.testPeriodOpen(getCtx(), getMovementDate(), getC_DocType_ID(), getAD_Org_ID());
} }
if (dt.isOverwriteSeqOnComplete()) { if (dt.isOverwriteSeqOnComplete()) {
String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this); String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this);

View File

@ -2128,6 +2128,10 @@ public class MOrder extends X_C_Order implements DocAction
/* a42niem - BF IDEMPIERE-63 - check if document has been completed before */ /* a42niem - BF IDEMPIERE-63 - check if document has been completed before */
if (this.getProcessedOn().signum() == 0) { if (this.getProcessedOn().signum() == 0) {
setDateOrdered(new Timestamp (System.currentTimeMillis())); setDateOrdered(new Timestamp (System.currentTimeMillis()));
if (getDateAcct().before(getDateOrdered())) {
setDateAcct(getDateOrdered());
MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocTypeTarget_ID(), getAD_Org_ID());
}
} }
} }
if (dt.isOverwriteSeqOnComplete()) { if (dt.isOverwriteSeqOnComplete()) {

View File

@ -655,6 +655,7 @@ public class MPayment extends X_C_Payment
protected boolean beforeSave (boolean newRecord) protected boolean beforeSave (boolean newRecord)
{ {
if (isComplete() && if (isComplete() &&
! is_ValueChanged(COLUMNNAME_Processed) &&
( is_ValueChanged(COLUMNNAME_C_BankAccount_ID) ( is_ValueChanged(COLUMNNAME_C_BankAccount_ID)
|| is_ValueChanged(COLUMNNAME_C_BPartner_ID) || is_ValueChanged(COLUMNNAME_C_BPartner_ID)
|| is_ValueChanged(COLUMNNAME_C_Charge_ID) || is_ValueChanged(COLUMNNAME_C_Charge_ID)
@ -2094,6 +2095,10 @@ public class MPayment extends X_C_Payment
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
if (dt.isOverwriteDateOnComplete()) { if (dt.isOverwriteDateOnComplete()) {
setDateTrx(new Timestamp (System.currentTimeMillis())); setDateTrx(new Timestamp (System.currentTimeMillis()));
if (getDateAcct().before(getDateTrx())) {
setDateAcct(getDateTrx());
MPeriod.testPeriodOpen(getCtx(), getDateAcct(), getC_DocType_ID(), getAD_Org_ID());
}
} }
if (dt.isOverwriteSeqOnComplete()) { if (dt.isOverwriteSeqOnComplete()) {
String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this); String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this);

View File

@ -364,6 +364,7 @@ public class MRequisition extends X_M_Requisition implements DocAction
MDocType dt = MDocType.get(getCtx(), getC_DocType_ID()); MDocType dt = MDocType.get(getCtx(), getC_DocType_ID());
if (dt.isOverwriteDateOnComplete()) { if (dt.isOverwriteDateOnComplete()) {
setDateDoc(new Timestamp (System.currentTimeMillis())); setDateDoc(new Timestamp (System.currentTimeMillis()));
MPeriod.testPeriodOpen(getCtx(), getDateDoc(), MDocType.DOCBASETYPE_PurchaseRequisition, getAD_Org_ID());
} }
if (dt.isOverwriteSeqOnComplete()) { if (dt.isOverwriteSeqOnComplete()) {
String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this); String value = DB.getDocumentNo(getC_DocType_ID(), get_TrxName(), true, this);