From 0b663af8abf580dfe9c04a47346020711734b3e4 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 23 Apr 2020 00:30:12 +0200 Subject: [PATCH] IDEMPIERE-4220 payment could not be committed due to wrong invoice date --- org.adempiere.base/src/org/compiere/model/MPayment.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/org.adempiere.base/src/org/compiere/model/MPayment.java b/org.adempiere.base/src/org/compiere/model/MPayment.java index a1af3d15d6..6d9b0f0fcd 100644 --- a/org.adempiere.base/src/org/compiere/model/MPayment.java +++ b/org.adempiere.base/src/org/compiere/model/MPayment.java @@ -2339,6 +2339,10 @@ public class MPayment extends X_C_Payment Msg.translate(getCtx(), "C_Payment_ID") + ": " + getDocumentNo() + " [1]", get_TrxName()); alloc.setAD_Org_ID(getAD_Org_ID()); alloc.setDateAcct(getDateAcct()); // in case date acct is different from datetrx in payment + MInvoice invoice = MInvoice.get(getCtx(), getC_Invoice_ID()); + if (invoice.getDateAcct().after(alloc.getDateAcct())) { + alloc.setDateAcct(invoice.getDateAcct()); + } alloc.saveEx(); MAllocationLine aLine = null; if (isReceipt())