From 50f07cc5b4fdb10385de8077db02dc3564615cbb Mon Sep 17 00:00:00 2001 From: alara123 Date: Thu, 9 Sep 2021 10:40:42 -0500 Subject: [PATCH] IDEMPIERE-4885 Possible bug with uom conversion on invoice when create from shipment (#830) * IDEMPIERE-4885 #resolve * throw error if no uom conversion found --- .../src/org/compiere/grid/CreateFromInvoice.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/org.adempiere.ui/src/org/compiere/grid/CreateFromInvoice.java b/org.adempiere.ui/src/org/compiere/grid/CreateFromInvoice.java index 5cbbcd999d..56d213b897 100644 --- a/org.adempiere.ui/src/org/compiere/grid/CreateFromInvoice.java +++ b/org.adempiere.ui/src/org/compiere/grid/CreateFromInvoice.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.Vector; import java.util.logging.Level; +import org.adempiere.exceptions.AdempiereException; import org.compiere.apps.IStatusBar; import org.compiere.minigrid.IMiniTable; import org.compiere.model.GridTab; @@ -547,6 +548,14 @@ public abstract class CreateFromInvoice extends CreateFrom if (inoutLine != null) { invoiceLine.setShipLine(inoutLine); // overwrites + if(invoiceLine.getC_UOM_ID()!=inoutLine.getC_UOM_ID()) { + invoiceLine.setC_UOM_ID(inoutLine.getC_UOM_ID()); + BigDecimal PriceEntered = MUOMConversion.convertProductFrom (invoice.getCtx(), M_Product_ID, + inoutLine.getC_UOM_ID(), invoiceLine.getPriceEntered()); + if (PriceEntered == null) + throw new AdempiereException("No Conversion For Price=" + invoiceLine.getPriceEntered()); + invoiceLine.setPriceEntered(PriceEntered); + } } else { log.fine("No Receipt Line");