[ 1583825 ] No tax recalculation after line changes
This commit is contained in:
parent
8da50e3567
commit
0b426b1aad
|
@ -835,6 +835,15 @@ public class MInvoiceLine extends X_C_InvoiceLine
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// deathmeat: [ 1583825 ] No tax recalculation after line changes
|
||||||
|
if((MInvoiceTax.get(this, getPrecision(),
|
||||||
|
true, get_TrxName()).getTaxAmt().doubleValue() == 0.0D))
|
||||||
|
{
|
||||||
|
// Tax line total is zero, delete the line
|
||||||
|
MInvoiceTax.get(this, getPrecision(),
|
||||||
|
true, get_TrxName()).delete(true, get_TrxName());
|
||||||
|
}
|
||||||
|
|
||||||
// Update Invoice Header
|
// Update Invoice Header
|
||||||
String sql = "UPDATE C_Invoice i"
|
String sql = "UPDATE C_Invoice i"
|
||||||
+ " SET TotalLines="
|
+ " SET TotalLines="
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
* under the terms version 2 of the GNU General Public License as published *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
* by the Free Software Foundation. This program is distributed in the hope *
|
* by the Free Software Foundation. This program is distributed in the hope *
|
||||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
|
@ -768,42 +768,42 @@ public class MOrderLine extends X_C_OrderLine
|
||||||
&& getM_AttributeSetInstance_ID() != 0
|
&& getM_AttributeSetInstance_ID() != 0
|
||||||
&& (newRecord || is_ValueChanged("M_Product_ID")
|
&& (newRecord || is_ValueChanged("M_Product_ID")
|
||||||
|| is_ValueChanged("M_AttributeSetInstance_ID")
|
|| is_ValueChanged("M_AttributeSetInstance_ID")
|
||||||
|| is_ValueChanged("M_Warehouse_ID")))
|
|| is_ValueChanged("M_Warehouse_ID")))
|
||||||
{
|
{
|
||||||
MProduct product = getProduct();
|
MProduct product = getProduct();
|
||||||
if (product.isStocked())
|
if (product.isStocked())
|
||||||
{
|
{
|
||||||
int M_AttributeSet_ID = product.getM_AttributeSet_ID();
|
int M_AttributeSet_ID = product.getM_AttributeSet_ID();
|
||||||
boolean isInstance = M_AttributeSet_ID != 0;
|
boolean isInstance = M_AttributeSet_ID != 0;
|
||||||
if (isInstance)
|
if (isInstance)
|
||||||
{
|
{
|
||||||
MAttributeSet mas = MAttributeSet.get(getCtx(), M_AttributeSet_ID);
|
MAttributeSet mas = MAttributeSet.get(getCtx(), M_AttributeSet_ID);
|
||||||
isInstance = mas.isInstanceAttribute();
|
isInstance = mas.isInstanceAttribute();
|
||||||
}
|
}
|
||||||
// Max
|
// Max
|
||||||
if (isInstance)
|
if (isInstance)
|
||||||
{
|
{
|
||||||
MStorage[] storages = MStorage.getWarehouse(getCtx(),
|
MStorage[] storages = MStorage.getWarehouse(getCtx(),
|
||||||
getM_Warehouse_ID(), getM_Product_ID(), getM_AttributeSetInstance_ID(),
|
getM_Warehouse_ID(), getM_Product_ID(), getM_AttributeSetInstance_ID(),
|
||||||
M_AttributeSet_ID, false, null, true, get_TrxName());
|
M_AttributeSet_ID, false, null, true, get_TrxName());
|
||||||
BigDecimal qty = Env.ZERO;
|
BigDecimal qty = Env.ZERO;
|
||||||
for (int i = 0; i < storages.length; i++)
|
for (int i = 0; i < storages.length; i++)
|
||||||
{
|
{
|
||||||
if (storages[i].getM_AttributeSetInstance_ID() == getM_AttributeSetInstance_ID())
|
if (storages[i].getM_AttributeSetInstance_ID() == getM_AttributeSetInstance_ID())
|
||||||
qty = qty.add(storages[i].getQtyOnHand());
|
qty = qty.add(storages[i].getQtyOnHand());
|
||||||
}
|
}
|
||||||
if (getQtyOrdered().compareTo(qty) > 0)
|
if (getQtyOrdered().compareTo(qty) > 0)
|
||||||
{
|
{
|
||||||
log.warning("Qty - Stock=" + qty + ", Ordered=" + getQtyOrdered());
|
log.warning("Qty - Stock=" + qty + ", Ordered=" + getQtyOrdered());
|
||||||
log.saveError("QtyInsufficient", "=" + qty);
|
log.saveError("QtyInsufficient", "=" + qty);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // stocked
|
} // stocked
|
||||||
} // SO instance
|
} // SO instance
|
||||||
|
|
||||||
// FreightAmt Not used
|
// FreightAmt Not used
|
||||||
if (Env.ZERO.compareTo(getFreightAmt()) != 0)
|
if (Env.ZERO.compareTo(getFreightAmt()) != 0)
|
||||||
setFreightAmt(Env.ZERO);
|
setFreightAmt(Env.ZERO);
|
||||||
|
|
||||||
// Set Tax
|
// Set Tax
|
||||||
|
@ -911,6 +911,15 @@ public class MOrderLine extends X_C_OrderLine
|
||||||
if (!tax.save(get_TrxName()))
|
if (!tax.save(get_TrxName()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// deathmeat: [ 1583825 ] No tax recalculation after line changes
|
||||||
|
if((MOrderTax.get(this, getPrecision(),
|
||||||
|
true, get_TrxName()).getTaxAmt().doubleValue() == 0.0D))
|
||||||
|
{
|
||||||
|
// Tax line total is zero, delete the line
|
||||||
|
MOrderTax.get(this, getPrecision(),
|
||||||
|
true, get_TrxName()).delete(true, get_TrxName());
|
||||||
|
}
|
||||||
|
|
||||||
// Update Order Header
|
// Update Order Header
|
||||||
String sql = "UPDATE C_Order i"
|
String sql = "UPDATE C_Order i"
|
||||||
+ " SET TotalLines="
|
+ " SET TotalLines="
|
||||||
|
|
Loading…
Reference in New Issue