Merge release-1.0c
This commit is contained in:
commit
08752afca5
|
@ -0,0 +1,25 @@
|
||||||
|
SET SQLBLANKLINES ON
|
||||||
|
SET DEFINE OFF
|
||||||
|
|
||||||
|
|
||||||
|
-- Nov 13, 2013 5:26:33 PM MYT
|
||||||
|
-- Make validation of purchase order quantity against invoice and receipt quantity optional
|
||||||
|
INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,Description,AD_SysConfig_UU,Created,Updated,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200039,'C','Y','Set this to false (N) to allow material receipt and invoice with quantity more than purchase order quantity.','f473c472-1285-4936-8bb8-2f36f68de12e',TO_DATE('2013-11-13 17:26:26','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2013-11-13 17:26:26','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'VALIDATE_MATCHING_TO_ORDERED_QTY',0,'D')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 13, 2013 7:44:29 PM MYT
|
||||||
|
-- Make validation of purchase order quantity against invoice and receipt quantity optional
|
||||||
|
INSERT INTO AD_Element (ColumnName,AD_Element_ID,Help,Name,Description,PrintName,AD_Element_UU,Created,Updated,CreatedBy,AD_Org_ID,UpdatedBy,IsActive,AD_Client_ID,EntityType) VALUES ('QtyOverReceipt',202627,'Calculated: Receipt - ordered quantity','Over Receipt','Over Receipt Quantity','Over Receipt','6872e34a-74bc-4590-b8e3-da15b6d365ba',TO_DATE('2013-11-13 19:44:25','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2013-11-13 19:44:25','YYYY-MM-DD HH24:MI:SS'),100,0,100,'Y',0,'D')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 13, 2013 7:45:25 PM MYT
|
||||||
|
INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Table_ID,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,DefaultValue,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,AD_Element_ID,IsSecure) VALUES (0,'N',1,320,210888,'N','N','N',0,'N',22,'N',29,'N','N','Y','8a1f15d1-412e-464e-9797-b547a152b54b','Y','QtyOverReceipt','Over Receipt Quantity','0','Calculated: Receipt - ordered quantity','Over Receipt','N',TO_DATE('2013-11-13 19:45:22','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_DATE('2013-11-13 19:45:22','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N',202627,'N')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 13, 2013 7:45:55 PM MYT
|
||||||
|
ALTER TABLE M_InOutLine ADD QtyOverReceipt NUMBER DEFAULT 0
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201311131356_IDEMPIERE-1530.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
-- Nov 13, 2013 5:26:33 PM MYT
|
||||||
|
-- Make validation of purchase order quantity against invoice and receipt quantity optional
|
||||||
|
INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,Description,AD_SysConfig_UU,Created,Updated,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200039,'C','Y','Set this to false (N) to allow material receipt and invoice with quantity more than purchase order quantity.','f473c472-1285-4936-8bb8-2f36f68de12e',TO_TIMESTAMP('2013-11-13 17:26:26','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2013-11-13 17:26:26','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'VALIDATE_MATCHING_TO_ORDERED_QTY',0,'D')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 13, 2013 7:44:29 PM MYT
|
||||||
|
-- Make validation of purchase order quantity against invoice and receipt quantity optional
|
||||||
|
INSERT INTO AD_Element (ColumnName,AD_Element_ID,Help,Name,Description,PrintName,AD_Element_UU,Created,Updated,CreatedBy,AD_Org_ID,UpdatedBy,IsActive,AD_Client_ID,EntityType) VALUES ('QtyOverReceipt',202627,'Calculated: Receipt - ordered quantity','Over Receipt','Over Receipt Quantity','Over Receipt','6872e34a-74bc-4590-b8e3-da15b6d365ba',TO_TIMESTAMP('2013-11-13 19:44:25','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2013-11-13 19:44:25','YYYY-MM-DD HH24:MI:SS'),100,0,100,'Y',0,'D')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 13, 2013 7:45:25 PM MYT
|
||||||
|
INSERT INTO AD_Column (SeqNoSelection,IsSyncDatabase,Version,AD_Table_ID,AD_Column_ID,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsKey,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsUpdateable,ColumnName,Description,DefaultValue,Help,Name,IsAllowCopy,Updated,CreatedBy,AD_Org_ID,IsActive,Created,UpdatedBy,IsToolbarButton,IsAlwaysUpdateable,AD_Client_ID,EntityType,IsEncrypted,AD_Element_ID,IsSecure) VALUES (0,'N',1,320,210888,'N','N','N',0,'N',22,'N',29,'N','N','Y','8a1f15d1-412e-464e-9797-b547a152b54b','Y','QtyOverReceipt','Over Receipt Quantity','0','Calculated: Receipt - ordered quantity','Over Receipt','N',TO_TIMESTAMP('2013-11-13 19:45:22','YYYY-MM-DD HH24:MI:SS'),100,0,'Y',TO_TIMESTAMP('2013-11-13 19:45:22','YYYY-MM-DD HH24:MI:SS'),100,'N','N',0,'D','N',202627,'N')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Nov 13, 2013 7:45:55 PM MYT
|
||||||
|
ALTER TABLE M_InOutLine ADD COLUMN QtyOverReceipt NUMERIC DEFAULT 0
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201311131356_IDEMPIERE-1530.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -434,6 +434,19 @@ public interface I_M_InOutLine
|
||||||
*/
|
*/
|
||||||
public BigDecimal getQtyEntered();
|
public BigDecimal getQtyEntered();
|
||||||
|
|
||||||
|
/** Column name QtyOverReceipt */
|
||||||
|
public static final String COLUMNNAME_QtyOverReceipt = "QtyOverReceipt";
|
||||||
|
|
||||||
|
/** Set Over Receipt.
|
||||||
|
* Over Receipt Quantity
|
||||||
|
*/
|
||||||
|
public void setQtyOverReceipt (BigDecimal QtyOverReceipt);
|
||||||
|
|
||||||
|
/** Get Over Receipt.
|
||||||
|
* Over Receipt Quantity
|
||||||
|
*/
|
||||||
|
public BigDecimal getQtyOverReceipt();
|
||||||
|
|
||||||
/** Column name Ref_InOutLine_ID */
|
/** Column name Ref_InOutLine_ID */
|
||||||
public static final String COLUMNNAME_Ref_InOutLine_ID = "Ref_InOutLine_ID";
|
public static final String COLUMNNAME_Ref_InOutLine_ID = "Ref_InOutLine_ID";
|
||||||
|
|
||||||
|
|
|
@ -758,6 +758,10 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
line.setM_RMALine_ID(peer.getRef_RMALine_ID());
|
line.setM_RMALine_ID(peer.getRef_RMALine_ID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!isSOTrx())
|
||||||
|
{
|
||||||
|
line.setQtyOverReceipt(fromLine.getQtyOverReceipt());
|
||||||
|
}
|
||||||
//
|
//
|
||||||
line.setProcessed(false);
|
line.setProcessed(false);
|
||||||
if (line.save(get_TrxName()))
|
if (line.save(get_TrxName()))
|
||||||
|
@ -1287,7 +1291,6 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
if (MovementType.charAt(1) == '-') // C- Customer Shipment - V- Vendor Return
|
if (MovementType.charAt(1) == '-') // C- Customer Shipment - V- Vendor Return
|
||||||
Qty = Qty.negate();
|
Qty = Qty.negate();
|
||||||
BigDecimal QtySO = Env.ZERO;
|
BigDecimal QtySO = Env.ZERO;
|
||||||
BigDecimal QtyPO = Env.ZERO;
|
|
||||||
|
|
||||||
// Update Order Line
|
// Update Order Line
|
||||||
MOrderLine oLine = null;
|
MOrderLine oLine = null;
|
||||||
|
@ -1298,8 +1301,6 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
+ ", Delivered=" + oLine.getQtyDelivered());
|
+ ", Delivered=" + oLine.getQtyDelivered());
|
||||||
if (isSOTrx())
|
if (isSOTrx())
|
||||||
QtySO = sLine.getMovementQty();
|
QtySO = sLine.getMovementQty();
|
||||||
else
|
|
||||||
QtyPO = sLine.getMovementQty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1338,6 +1339,27 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
reservationWarehouse_ID = oLine.getM_Warehouse_ID();
|
reservationWarehouse_ID = oLine.getM_Warehouse_ID();
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
BigDecimal overReceipt = BigDecimal.ZERO;
|
||||||
|
if (!isSOTrx())
|
||||||
|
{
|
||||||
|
if (!isReversal())
|
||||||
|
{
|
||||||
|
BigDecimal toDelivered = oLine.getQtyOrdered().subtract(oLine.getQtyDelivered());
|
||||||
|
if (sLine.getMovementQty().compareTo(toDelivered) > 0)
|
||||||
|
overReceipt = sLine.getMovementQty().subtract(toDelivered);
|
||||||
|
if (overReceipt.signum() != 0)
|
||||||
|
{
|
||||||
|
sLine.setQtyOverReceipt(overReceipt);
|
||||||
|
sLine.saveEx();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
overReceipt = sLine.getQtyOverReceipt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BigDecimal orderedQtyToUpdate = sLine.getMovementQty().subtract(overReceipt);
|
||||||
|
//
|
||||||
if (sLine.getM_AttributeSetInstance_ID() == 0)
|
if (sLine.getM_AttributeSetInstance_ID() == 0)
|
||||||
{
|
{
|
||||||
MInOutLineMA mas[] = MInOutLineMA.get(getCtx(),
|
MInOutLineMA mas[] = MInOutLineMA.get(getCtx(),
|
||||||
|
@ -1351,7 +1373,23 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
BigDecimal reservedDiff = Env.ZERO;
|
BigDecimal reservedDiff = Env.ZERO;
|
||||||
if (sLine.getC_OrderLine_ID() != 0)
|
if (sLine.getC_OrderLine_ID() != 0)
|
||||||
{
|
{
|
||||||
reservedDiff = ma.getMovementQty().negate();
|
if (isSOTrx())
|
||||||
|
{
|
||||||
|
reservedDiff = ma.getMovementQty().negate();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ma.getMovementQty().compareTo(orderedQtyToUpdate) >= 0)
|
||||||
|
{
|
||||||
|
orderedQtyToUpdate = orderedQtyToUpdate.subtract(ma.getMovementQty());
|
||||||
|
reservedDiff = ma.getMovementQty().negate();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
reservedDiff = orderedQtyToUpdate.negate();
|
||||||
|
orderedQtyToUpdate = BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Storage - see also VMatch.createMatchRecord
|
// Update Storage - see also VMatch.createMatchRecord
|
||||||
|
@ -1400,7 +1438,7 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
if(isSOTrx())
|
if(isSOTrx())
|
||||||
reservedDiff = QtySO.negate();
|
reservedDiff = QtySO.negate();
|
||||||
else
|
else
|
||||||
reservedDiff = QtyPO.negate();
|
reservedDiff = orderedQtyToUpdate.negate();
|
||||||
|
|
||||||
Timestamp dateMPolicy = getMovementDate();
|
Timestamp dateMPolicy = getMovementDate();
|
||||||
if(sLine.getM_AttributeSetInstance_ID()>0){
|
if(sLine.getM_AttributeSetInstance_ID()>0){
|
||||||
|
@ -1446,7 +1484,12 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
|
|
||||||
// Correct Order Line
|
// Correct Order Line
|
||||||
if (product != null && oLine != null) // other in VMatch.createMatchRecord
|
if (product != null && oLine != null) // other in VMatch.createMatchRecord
|
||||||
oLine.setQtyReserved(oLine.getQtyReserved().subtract(sLine.getMovementQty()));
|
{
|
||||||
|
if (isSOTrx())
|
||||||
|
oLine.setQtyReserved(oLine.getQtyReserved().subtract(sLine.getMovementQty()));
|
||||||
|
else
|
||||||
|
oLine.setQtyReserved(oLine.getQtyReserved().subtract(sLine.getMovementQty().subtract(sLine.getQtyOverReceipt())));
|
||||||
|
}
|
||||||
|
|
||||||
// Update Sales Order Line
|
// Update Sales Order Line
|
||||||
if (oLine != null)
|
if (oLine != null)
|
||||||
|
@ -2151,6 +2194,7 @@ public class MInOut extends X_M_InOut implements DocAction
|
||||||
MInOutLine rLine = rLines[i];
|
MInOutLine rLine = rLines[i];
|
||||||
rLine.setQtyEntered(rLine.getQtyEntered().negate());
|
rLine.setQtyEntered(rLine.getQtyEntered().negate());
|
||||||
rLine.setMovementQty(rLine.getMovementQty().negate());
|
rLine.setMovementQty(rLine.getMovementQty().negate());
|
||||||
|
rLine.setQtyOverReceipt(rLine.getQtyOverReceipt().negate());
|
||||||
rLine.setM_AttributeSetInstance_ID(sLines[i].getM_AttributeSetInstance_ID());
|
rLine.setM_AttributeSetInstance_ID(sLines[i].getM_AttributeSetInstance_ID());
|
||||||
// Goodwill: store original (voided/reversed) document line
|
// Goodwill: store original (voided/reversed) document line
|
||||||
rLine.setReversalLine_ID(sLines[i].getM_InOutLine_ID());
|
rLine.setReversalLine_ID(sLines[i].getM_InOutLine_ID());
|
||||||
|
|
|
@ -911,17 +911,21 @@ public class MMatchPO extends X_M_MatchPO
|
||||||
|
|
||||||
if (getC_OrderLine_ID() > 0)
|
if (getC_OrderLine_ID() > 0)
|
||||||
{
|
{
|
||||||
MOrderLine line = new MOrderLine(getCtx(), getC_OrderLine_ID(), get_TrxName());
|
boolean validateOrderedQty = MSysConfig.getBooleanValue(MSysConfig.VALIDATE_MATCHING_TO_ORDERED_QTY, true, Env.getAD_Client_ID(Env.getCtx()));
|
||||||
BigDecimal invoicedQty = DB.getSQLValueBD(get_TrxName(), "SELECT Coalesce(SUM(Qty),0) FROM M_MatchPO WHERE C_InvoiceLine_ID > 0 and C_OrderLine_ID=?" , getC_OrderLine_ID());
|
if (validateOrderedQty)
|
||||||
if (invoicedQty != null && invoicedQty.compareTo(line.getQtyOrdered()) > 0)
|
|
||||||
{
|
{
|
||||||
throw new IllegalStateException("Total matched invoiced qty > ordered qty. MatchedInvoicedQty="+invoicedQty+", OrderedQty="+line.getQtyOrdered()+", Line="+line);
|
MOrderLine line = new MOrderLine(getCtx(), getC_OrderLine_ID(), get_TrxName());
|
||||||
}
|
BigDecimal invoicedQty = DB.getSQLValueBD(get_TrxName(), "SELECT Coalesce(SUM(Qty),0) FROM M_MatchPO WHERE C_InvoiceLine_ID > 0 and C_OrderLine_ID=?" , getC_OrderLine_ID());
|
||||||
|
if (invoicedQty != null && invoicedQty.compareTo(line.getQtyOrdered()) > 0)
|
||||||
|
{
|
||||||
|
throw new IllegalStateException("Total matched invoiced qty > ordered qty. MatchedInvoicedQty="+invoicedQty+", OrderedQty="+line.getQtyOrdered()+", Line="+line);
|
||||||
|
}
|
||||||
|
|
||||||
BigDecimal deliveredQty = DB.getSQLValueBD(get_TrxName(), "SELECT Coalesce(SUM(Qty),0) FROM M_MatchPO WHERE M_InOutLine_ID > 0 and C_OrderLine_ID=?" , getC_OrderLine_ID());
|
BigDecimal deliveredQty = DB.getSQLValueBD(get_TrxName(), "SELECT Coalesce(SUM(Qty),0) FROM M_MatchPO WHERE M_InOutLine_ID > 0 and C_OrderLine_ID=?" , getC_OrderLine_ID());
|
||||||
if (deliveredQty != null && deliveredQty.compareTo(line.getQtyOrdered()) > 0)
|
if (deliveredQty != null && deliveredQty.compareTo(line.getQtyOrdered()) > 0)
|
||||||
{
|
{
|
||||||
throw new IllegalStateException("Total matched delivered qty > ordered qty. MatchedDeliveredQty="+deliveredQty+", OrderedQty="+line.getQtyOrdered()+", Line="+line);
|
throw new IllegalStateException("Total matched delivered qty > ordered qty. MatchedDeliveredQty="+deliveredQty+", OrderedQty="+line.getQtyOrdered()+", Line="+line);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,6 +121,7 @@ public class MSysConfig extends X_AD_SysConfig
|
||||||
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
|
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
|
||||||
public static final String TAX_SAVE_REQUEST_RESPONSE_LOG = "TAX_SAVE_REQUEST_RESPONSE_LOG";
|
public static final String TAX_SAVE_REQUEST_RESPONSE_LOG = "TAX_SAVE_REQUEST_RESPONSE_LOG";
|
||||||
public static final String ADDRESS_SAVE_REQUEST_RESPONSE_LOG = "ADDRESS_SAVE_REQUEST_RESPONSE_LOG";
|
public static final String ADDRESS_SAVE_REQUEST_RESPONSE_LOG = "ADDRESS_SAVE_REQUEST_RESPONSE_LOG";
|
||||||
|
public static final String VALIDATE_MATCHING_TO_ORDERED_QTY = "VALIDATE_MATCHING_TO_ORDERED_QTY";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard Constructor
|
* Standard Constructor
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class X_M_InOutLine extends PO implements I_M_InOutLine, I_Persistent
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 20131031L;
|
private static final long serialVersionUID = 20131113L;
|
||||||
|
|
||||||
/** Standard Constructor */
|
/** Standard Constructor */
|
||||||
public X_M_InOutLine (Properties ctx, int M_InOutLine_ID, String trxName)
|
public X_M_InOutLine (Properties ctx, int M_InOutLine_ID, String trxName)
|
||||||
|
@ -704,6 +704,26 @@ public class X_M_InOutLine extends PO implements I_M_InOutLine, I_Persistent
|
||||||
return bd;
|
return bd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Set Over Receipt.
|
||||||
|
@param QtyOverReceipt
|
||||||
|
Over Receipt Quantity
|
||||||
|
*/
|
||||||
|
public void setQtyOverReceipt (BigDecimal QtyOverReceipt)
|
||||||
|
{
|
||||||
|
set_Value (COLUMNNAME_QtyOverReceipt, QtyOverReceipt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get Over Receipt.
|
||||||
|
@return Over Receipt Quantity
|
||||||
|
*/
|
||||||
|
public BigDecimal getQtyOverReceipt ()
|
||||||
|
{
|
||||||
|
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_QtyOverReceipt);
|
||||||
|
if (bd == null)
|
||||||
|
return Env.ZERO;
|
||||||
|
return bd;
|
||||||
|
}
|
||||||
|
|
||||||
/** Set Referenced Shipment Line.
|
/** Set Referenced Shipment Line.
|
||||||
@param Ref_InOutLine_ID Referenced Shipment Line */
|
@param Ref_InOutLine_ID Referenced Shipment Line */
|
||||||
public void setRef_InOutLine_ID (int Ref_InOutLine_ID)
|
public void setRef_InOutLine_ID (int Ref_InOutLine_ID)
|
||||||
|
|
Loading…
Reference in New Issue