From 396471ba07d9153571218734e186a1791f68be4c Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 3 Nov 2016 23:06:49 +0100 Subject: [PATCH] IDEMPIERE-178 Orders and Invoices must disallow amount lines without product/charge / found an issue with an invoice line that had a quantity but not amount - and the default product expense account was inactive - the invoice line still tries to post the "comment" line and fails - so the comment line must have both qty and price zero --- org.adempiere.base/src/org/compiere/model/MInvoiceLine.java | 2 +- org.adempiere.base/src/org/compiere/model/MOrderLine.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java index b94fd6d418..c2957335dd 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoiceLine.java @@ -911,7 +911,7 @@ public class MInvoiceLine extends X_C_InvoiceLine * IDEMPIERE-178 Orders and Invoices must disallow amount lines without product/charge */ if (getParent().getC_DocTypeTarget().isChargeOrProductMandatory()) { - if (getC_Charge_ID() == 0 && getM_Product_ID() == 0 && getPriceEntered().signum() != 0) { + if (getC_Charge_ID() == 0 && getM_Product_ID() == 0 && (getPriceEntered().signum() != 0 || getQtyEntered().signum() != 0)) { log.saveError("FillMandatory", Msg.translate(getCtx(), "ChargeOrProductMandatory")); return false; } diff --git a/org.adempiere.base/src/org/compiere/model/MOrderLine.java b/org.adempiere.base/src/org/compiere/model/MOrderLine.java index 952d216f9e..36c8e1c5ab 100644 --- a/org.adempiere.base/src/org/compiere/model/MOrderLine.java +++ b/org.adempiere.base/src/org/compiere/model/MOrderLine.java @@ -969,7 +969,7 @@ public class MOrderLine extends X_C_OrderLine * IDEMPIERE-178 Orders and Invoices must disallow amount lines without product/charge */ if (getParent().getC_DocTypeTarget().isChargeOrProductMandatory()) { - if (getC_Charge_ID() == 0 && getM_Product_ID() == 0 && getPriceEntered().signum() != 0) { + if (getC_Charge_ID() == 0 && getM_Product_ID() == 0 && (getPriceEntered().signum() != 0 || getQtyEntered().signum() != 0)) { log.saveError("FillMandatory", Msg.translate(getCtx(), "ChargeOrProductMandatory")); return false; }