From c3940f38b719a874e4de322910d48126ffe970eb Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 14 Dec 2017 15:43:13 +0100 Subject: [PATCH] IDEMPIERE-3573 Invoice Vendor (create lines from..) - Error - Total matched qty > movement qty --- .../src/org/compiere/grid/CreateFromInvoice.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/org.adempiere.ui/src/org/compiere/grid/CreateFromInvoice.java b/org.adempiere.ui/src/org/compiere/grid/CreateFromInvoice.java index 1a2fa9d335..13c96ac176 100644 --- a/org.adempiere.ui/src/org/compiere/grid/CreateFromInvoice.java +++ b/org.adempiere.ui/src/org/compiere/grid/CreateFromInvoice.java @@ -30,6 +30,7 @@ import org.compiere.model.MInOutLine; import org.compiere.model.MInvoice; import org.compiere.model.MInvoiceLine; import org.compiere.model.MInvoicePaySchedule; +import org.compiere.model.MMatchInv; import org.compiere.model.MOrder; import org.compiere.model.MOrderLine; import org.compiere.model.MOrderPaySchedule; @@ -495,7 +496,12 @@ public abstract class CreateFromInvoice extends CreateFrom for (int j = 0; j < lines.length; j++) { MInOutLine line = lines[j]; - if (line.getQtyEntered().compareTo(QtyEntered) == 0) + // qty matched + BigDecimal qtyMatched = Env.ZERO; + for (MMatchInv match : MMatchInv.getInOutLine(Env.getCtx(), line.getM_InOutLine_ID(), trxName)) { + qtyMatched = qtyMatched.add(match.getQty()); + } + if (line.getQtyEntered().subtract(qtyMatched).compareTo(QtyEntered) == 0) { inoutLine = line; M_InOutLine_ID = inoutLine.getM_InOutLine_ID();