IDEMPIERE-4885 Possible bug with uom conversion on invoice when create from shipment (#830)

* IDEMPIERE-4885 #resolve

* throw error if no uom conversion found
This commit is contained in:
alara123 2021-09-09 10:40:42 -05:00 committed by GitHub
parent 60c9517c4d
commit 50f07cc5b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -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");