hg merge release-6.2 (merge release6.2 into default)

This commit is contained in:
Carlos Ruiz 2019-09-14 12:17:35 +02:00
commit 4af8195f5b
2 changed files with 8 additions and 3 deletions

View File

@ -148,7 +148,7 @@ public class PaySelectionCreateFrom extends SvrProcess
.append(" WHERE i.C_Invoice_ID=psl.C_Invoice_ID AND psl.IsActive='Y'") .append(" WHERE i.C_Invoice_ID=psl.C_Invoice_ID AND psl.IsActive='Y'")
.append(" AND (pmt.DocStatus IS NULL OR pmt.DocStatus NOT IN ('VO','RE')) )") .append(" AND (pmt.DocStatus IS NULL OR pmt.DocStatus NOT IN ('VO','RE')) )")
// Don't generate again invoices already on this payment selection // Don't generate again invoices already on this payment selection
.append(" AND i.C_Invoice_ID NOT IN (SELECT i.C_Invoice_ID FROM C_PaySelectionLine psl WHERE psl.C_PaySelection_ID=?)"); // ##p9 .append(" AND i.C_Invoice_ID NOT IN (SELECT psl.C_Invoice_ID FROM C_PaySelectionLine psl WHERE psl.C_PaySelection_ID=?)"); // ##p9
// Disputed // Disputed
if (!p_IncludeInDispute) if (!p_IncludeInDispute)
sqlWhere.append(" AND i.IsInDispute='N'"); sqlWhere.append(" AND i.IsInDispute='N'");

View File

@ -2282,12 +2282,17 @@ public class MPayment extends X_C_Payment
for (int i = 0; i < pAllocs.length; i++) for (int i = 0; i < pAllocs.length; i++)
{ {
MPaymentAllocate pa = pAllocs[i]; MPaymentAllocate pa = pAllocs[i];
BigDecimal allocationAmt = pa.getAmount(); // underpayment
if (pa.getOverUnderAmt().signum() < 0 && pa.getAmount().signum() > 0)
allocationAmt = allocationAmt.add(pa.getOverUnderAmt()); // overpayment (negative)
MAllocationLine aLine = null; MAllocationLine aLine = null;
if (isReceipt()) if (isReceipt())
aLine = new MAllocationLine (alloc, pa.getAmount(), aLine = new MAllocationLine (alloc, allocationAmt,
pa.getDiscountAmt(), pa.getWriteOffAmt(), pa.getOverUnderAmt()); pa.getDiscountAmt(), pa.getWriteOffAmt(), pa.getOverUnderAmt());
else else
aLine = new MAllocationLine (alloc, pa.getAmount().negate(), aLine = new MAllocationLine (alloc, allocationAmt.negate(),
pa.getDiscountAmt().negate(), pa.getWriteOffAmt().negate(), pa.getOverUnderAmt().negate()); pa.getDiscountAmt().negate(), pa.getWriteOffAmt().negate(), pa.getOverUnderAmt().negate());
aLine.setDocInfo(pa.getC_BPartner_ID(), 0, pa.getC_Invoice_ID()); aLine.setDocInfo(pa.getC_BPartner_ID(), 0, pa.getC_Invoice_ID());
aLine.setPaymentInfo(getC_Payment_ID(), 0); aLine.setPaymentInfo(getC_Payment_ID(), 0);