Package org.compiere.model
Class MOrderLine
- java.lang.Object
-
- org.compiere.model.PO
-
- org.compiere.model.X_C_OrderLine
-
- org.compiere.model.MOrderLine
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparator<Object>
,I_C_OrderLine
,I_Persistent
,Evaluatee
public class MOrderLine extends X_C_OrderLine
Order Line Model.MOrderLine ol = new MOrderLine(m_order); ol.setM_Product_ID(wbl.getM_Product_ID()); ol.setQtyOrdered(wbl.getQuantity()); ol.setPrice(); ol.setPriceActual(wbl.getPrice()); ol.setTax(); ol.saveEx();
- Version:
- $Id: MOrderLine.java,v 1.6 2006/10/02 05:18:39 jjanke Exp $
- Author:
- Jorg Janke, Teo Sarca, SC ARHIPAC SERVICE SRL
- BF [ 2588043 ] Insufficient message ProductNotOnPriceList
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected MCharge
m_charge
Chargeprotected boolean
m_IsSOTrx
protected int
m_M_PriceList_ID
protected MOrder
m_parent
Parentprotected Integer
m_precision
Cached Currency Precisionprotected MProduct
m_product
Productprotected IProductPricing
m_productPrice
protected MTax
m_tax
Taxprotected static CLogger
s_log
Logger-
Fields inherited from class org.compiere.model.PO
ACCESSLEVEL_ALL, ACCESSLEVEL_CLIENT, ACCESSLEVEL_CLIENTORG, ACCESSLEVEL_ORG, ACCESSLEVEL_SYSTEM, ACCESSLEVEL_SYSTEMCLIENT, ENTITYTYPE_Dictionary, ENTITYTYPE_UserMaintained, I_ZERO, LOCAL_TRX_PREFIX, log, p_ctx, p_info, XML_ATTRIBUTE_AD_Table_ID, XML_ATTRIBUTE_Record_ID
-
Fields inherited from interface org.compiere.model.I_C_OrderLine
accessLevel, COLUMNNAME_AD_Client_ID, COLUMNNAME_AD_Org_ID, COLUMNNAME_AD_OrgTrx_ID, COLUMNNAME_C_Activity_ID, COLUMNNAME_C_BPartner_ID, COLUMNNAME_C_BPartner_Location_ID, COLUMNNAME_C_Campaign_ID, COLUMNNAME_C_Charge_ID, COLUMNNAME_C_Currency_ID, COLUMNNAME_C_Order_ID, COLUMNNAME_C_OrderLine_ID, COLUMNNAME_C_OrderLine_UU, COLUMNNAME_C_Project_ID, COLUMNNAME_C_ProjectPhase_ID, COLUMNNAME_C_ProjectTask_ID, COLUMNNAME_C_Tax_ID, COLUMNNAME_C_UOM_ID, COLUMNNAME_Created, COLUMNNAME_CreatedBy, COLUMNNAME_CreateProduction, COLUMNNAME_CreateShipment, COLUMNNAME_DateDelivered, COLUMNNAME_DateInvoiced, COLUMNNAME_DateOrdered, COLUMNNAME_DatePromised, COLUMNNAME_Description, COLUMNNAME_Discount, COLUMNNAME_FreightAmt, COLUMNNAME_IsActive, COLUMNNAME_IsDescription, COLUMNNAME_Line, COLUMNNAME_LineNetAmt, COLUMNNAME_Link_OrderLine_ID, COLUMNNAME_M_AttributeSetInstance_ID, COLUMNNAME_M_Product_ID, COLUMNNAME_M_Promotion_ID, COLUMNNAME_M_Shipper_ID, COLUMNNAME_M_Warehouse_ID, COLUMNNAME_PP_Cost_Collector_ID, COLUMNNAME_PriceActual, COLUMNNAME_PriceCost, COLUMNNAME_PriceEntered, COLUMNNAME_PriceLimit, COLUMNNAME_PriceList, COLUMNNAME_Processed, COLUMNNAME_QtyDelivered, COLUMNNAME_QtyEntered, COLUMNNAME_QtyInvoiced, COLUMNNAME_QtyLostSales, COLUMNNAME_QtyOrdered, COLUMNNAME_QtyReserved, COLUMNNAME_Ref_OrderLine_ID, COLUMNNAME_RRAmt, COLUMNNAME_RRStartDate, COLUMNNAME_S_ResourceAssignment_ID, COLUMNNAME_Updated, COLUMNNAME_UpdatedBy, COLUMNNAME_User1_ID, COLUMNNAME_User2_ID, Model, Table_ID, Table_Name
-
-
Constructor Summary
Constructors Constructor Description MOrderLine(Properties ctx, int C_OrderLine_ID, String trxName)
Default ConstructorMOrderLine(Properties ctx, ResultSet rs, String trxName)
Load ConstructorMOrderLine(MOrder order)
Parent Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDescription(String description)
Add to Descriptionprotected boolean
afterDelete(boolean success)
After Deleteprotected boolean
afterSave(boolean newRecord, boolean success)
After Saveprotected boolean
beforeDelete()
Before Deleteprotected boolean
beforeSave(boolean newRecord)
Before Saveboolean
canChangeWarehouse()
Can Change Warehousevoid
clearParent()
int
getAD_OrgTrx_ID()
Get AD_OrgTrx_IDBigDecimal
getBase(String CostDistribution)
Get Base value for Cost Distributionint
getC_Activity_ID()
Get C_Activity_IDint
getC_Campaign_ID()
Get C_Campaign_IDint
getC_Project_ID()
Get C_Project_IDMCharge
getCharge()
Get ChargeString
getDescriptionText()
Get Description Text.String
getName()
Get Namestatic BigDecimal
getNotReserved(Properties ctx, int M_Warehouse_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int excludeC_OrderLine_ID)
Get Order Unreserved QtyMOrder
getParent()
Get Parentint
getPrecision()
Get Currency Precision from CurrencyMProduct
getProduct()
Get Productprotected IProductPricing
getProductPricing(int M_PriceList_ID)
Get and calculate Product Pricingprotected MTax
getTax()
Get Tax (immutable)int
getUser1_ID()
Get User2_IDint
getUser2_ID()
Get User2_IDboolean
isTaxIncluded()
Is Tax Included in Amountvoid
setC_Charge_ID(int C_Charge_ID)
Set C_Charge_IDvoid
setDiscount()
Set Discountvoid
setHeaderInfo(MOrder order)
Set Header Infovoid
setLineNetAmt()
Calculate Extended Amt.void
setM_AttributeSetInstance_ID(int M_AttributeSetInstance_ID)
Set M_AttributeSetInstance_IDvoid
setM_Product_ID(int M_Product_ID, boolean setUOM)
Set M_Product_IDvoid
setM_Product_ID(int M_Product_ID, int C_UOM_ID)
Set Product and UOMvoid
setM_Warehouse_ID(int M_Warehouse_ID)
Set Warehousevoid
setOrder(MOrder order)
Set Defaults from Order.void
setPrice()
Set Price for Product and PriceList.void
setPrice(int M_PriceList_ID)
Set Price for Product and PriceListvoid
setPrice(BigDecimal PriceActual)
Set Price Entered/Actual.void
setPriceActual(BigDecimal PriceActual)
Set Price Actual.void
setProduct(MProduct product)
Set Productvoid
setQty(BigDecimal Qty)
Set Qty Entered/Ordered.void
setQtyEntered(BigDecimal QtyEntered)
Set Qty Entered - enforce entered UOMvoid
setQtyOrdered(BigDecimal QtyOrdered)
Set Qty Ordered - enforce Product UOMboolean
setTax()
Set TaxString
toString()
String Representationboolean
updateHeaderTax()
Update Tax and Headerboolean
updateOrderTax(boolean oldTax)
Recalculate order tax-
Methods inherited from class org.compiere.model.X_C_OrderLine
get_AccessLevel, getC_Activity, getC_BPartner, getC_BPartner_ID, getC_BPartner_Location, getC_BPartner_Location_ID, getC_Campaign, getC_Charge, getC_Charge_ID, getC_Currency, getC_Currency_ID, getC_Order, getC_Order_ID, getC_OrderLine_ID, getC_OrderLine_UU, getC_Project, getC_ProjectPhase, getC_ProjectPhase_ID, getC_ProjectTask, getC_ProjectTask_ID, getC_Tax, getC_Tax_ID, getC_UOM, getC_UOM_ID, getCreateProduction, getCreateShipment, getDateDelivered, getDateInvoiced, getDateOrdered, getDatePromised, getDescription, getDiscount, getFreightAmt, getKeyNamePair, getLine, getLineNetAmt, getLink_OrderLine, getLink_OrderLine_ID, getM_AttributeSetInstance, getM_AttributeSetInstance_ID, getM_Product, getM_Product_ID, getM_Promotion, getM_Promotion_ID, getM_Shipper, getM_Shipper_ID, getM_Warehouse, getM_Warehouse_ID, getPP_Cost_Collector, getPP_Cost_Collector_ID, getPriceActual, getPriceCost, getPriceEntered, getPriceLimit, getPriceList, getQtyDelivered, getQtyEntered, getQtyInvoiced, getQtyLostSales, getQtyOrdered, getQtyReserved, getRef_OrderLine, getRef_OrderLine_ID, getRRAmt, getRRStartDate, getS_ResourceAssignment_ID, getUser1, getUser2, initPO, isDescription, isProcessed, setAD_OrgTrx_ID, setC_Activity_ID, setC_BPartner_ID, setC_BPartner_Location_ID, setC_Campaign_ID, setC_Currency_ID, setC_Order_ID, setC_OrderLine_ID, setC_OrderLine_UU, setC_Project_ID, setC_ProjectPhase_ID, setC_ProjectTask_ID, setC_Tax_ID, setC_UOM_ID, setCreateProduction, setCreateShipment, setDateDelivered, setDateInvoiced, setDateOrdered, setDatePromised, setDescription, setDiscount, setFreightAmt, setIsDescription, setLine, setLineNetAmt, setLink_OrderLine_ID, setM_Product_ID, setM_Promotion_ID, setM_Shipper_ID, setPP_Cost_Collector_ID, setPriceCost, setPriceEntered, setPriceLimit, setPriceList, setProcessed, setQtyDelivered, setQtyInvoiced, setQtyLostSales, setQtyReserved, setRef_OrderLine_ID, setRRAmt, setRRStartDate, setS_ResourceAssignment_ID, setUser1_ID, setUser2_ID
-
Methods inherited from class org.compiere.model.PO
checkImmutable, clearCrossTenantSafe, clone, columnExists, columnExists, compare, copyPO, copyValues, copyValues, createAttachment, delete, delete, delete_Accounting, delete_Tree, deleteEx, deleteEx, dump, dump, equals, get_Attribute, get_Attributes, get_ColumnCount, get_ColumnDescription, get_ColumnDisplayType, get_ColumnIndex, get_ColumnLabel, get_ColumnLookup, get_ColumnName, get_DisplayValue, get_HashMap, get_ID, get_IDOld, get_KeyColumns, get_Logger, get_OptimisticLockingColumns, get_Table_ID, get_TableName, get_Translation, get_Translation, get_Translation, get_Translation, get_Translation, get_TrxName, get_Value, get_Value, get_ValueAsBoolean, get_ValueAsInt, get_ValueAsInt, get_ValueAsString, get_ValueDifference, get_ValueDifference, get_ValueE, get_ValueOfColumn, get_ValueOld, get_ValueOld, get_ValueOldAsInt, get_WhereClause, get_WhereClause, get_xmlDocument, get_xmlString, getAD_Client_ID, getAD_Org_ID, getAllIDs, getAttachment, getAttachment, getAttachmentData, getCreated, getCreatedBy, getCtx, getDoc, getFindParameter, getPdfAttachment, getUpdated, getUpdatedBy, getUUIDColumnName, getUUIDColumnName, hashCode, insert_Accounting, insert_Tree, insert_Tree, is_Changed, is_Immutable, is_new, is_UseOptimisticLocking, is_ValueChanged, is_ValueChanged, isActive, isAttachment, isColumnMandatory, isColumnUpdateable, isMandatoryOK, isPdfAttachment, isReplication, load, load, load, load, load, loadByUU, loadComplete, loadDefaults, loadSpecial, lock, makeImmutable, postDelete, retrieveIdOfParentValue, retrieveIdOfParentValue, save, save, saveEx, saveEx, saveNew_afterSetID, saveNew_getID, saveNewSpecial, saveReplica, saveUpdate, set_Attribute, set_ColumnUpdateable, set_CustomColumn, set_CustomColumnReturningBoolean, set_OptimisticLockingColumns, set_TrxName, set_TrxName, set_UseOptimisticLocking, set_Value, set_Value, set_Value, set_Value, set_ValueE, set_ValueNoCheck, set_ValueNoCheckE, set_ValueOfColumn, set_ValueOfColumn, set_ValueOfColumnReturningBoolean, set_ValueOfColumnReturningBoolean, setAD_Client_ID, setAD_Org_ID, setClientOrg, setClientOrg, setCrossTenantSafe, setDoc, setDocWorkflowMgr, setIsActive, setProcessedOn, setReplication, setStandardDefaults, setUpdateable, setUpdatedBy, unlock, update_Tree, validForeignKeys
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Methods inherited from interface org.compiere.model.I_C_OrderLine
getAD_Client_ID, getAD_Org_ID, getCreated, getCreatedBy, getUpdated, getUpdatedBy, isActive, setAD_Org_ID, setIsActive
-
Methods inherited from interface org.compiere.model.I_Persistent
save
-
-
-
-
Field Detail
-
s_log
protected static CLogger s_log
Logger
-
m_M_PriceList_ID
protected int m_M_PriceList_ID
-
m_IsSOTrx
protected boolean m_IsSOTrx
-
m_productPrice
protected IProductPricing m_productPrice
-
m_tax
protected MTax m_tax
Tax
-
m_precision
protected Integer m_precision
Cached Currency Precision
-
m_product
protected MProduct m_product
Product
-
m_charge
protected MCharge m_charge
Charge
-
m_parent
protected MOrder m_parent
Parent
-
-
Constructor Detail
-
MOrderLine
public MOrderLine(Properties ctx, int C_OrderLine_ID, String trxName)
Default Constructor- Parameters:
ctx
- contextC_OrderLine_ID
- order line to loadtrxName
- trx name
-
MOrderLine
public MOrderLine(MOrder order)
Parent Constructor. ol.setM_Product_ID(wbl.getM_Product_ID()); ol.setQtyOrdered(wbl.getQuantity()); ol.setPrice(); ol.setPriceActual(wbl.getPrice()); ol.setTax(); ol.saveEx();- Parameters:
order
- parent order
-
MOrderLine
public MOrderLine(Properties ctx, ResultSet rs, String trxName)
Load Constructor- Parameters:
ctx
- contextrs
- result set recordtrxName
- transaction
-
-
Method Detail
-
getNotReserved
public static BigDecimal getNotReserved(Properties ctx, int M_Warehouse_ID, int M_Product_ID, int M_AttributeSetInstance_ID, int excludeC_OrderLine_ID)
Get Order Unreserved Qty- Parameters:
ctx
- contextM_Warehouse_ID
- whM_Product_ID
- productM_AttributeSetInstance_ID
- asiexcludeC_OrderLine_ID
- exclude C_OrderLine_ID- Returns:
- Unreserved Qty
-
setOrder
public void setOrder(MOrder order)
Set Defaults from Order. Does not set Parent !!- Parameters:
order
- order
-
setHeaderInfo
public void setHeaderInfo(MOrder order)
Set Header Info- Parameters:
order
- order
-
getParent
public MOrder getParent()
Get Parent- Returns:
- parent
-
setPrice
public void setPrice(BigDecimal PriceActual)
Set Price Entered/Actual. Use this Method if the Line UOM is the Product UOM- Parameters:
PriceActual
- price
-
setPriceActual
public void setPriceActual(BigDecimal PriceActual)
Set Price Actual. (actual price is not updateable)- Specified by:
setPriceActual
in interfaceI_C_OrderLine
- Overrides:
setPriceActual
in classX_C_OrderLine
- Parameters:
PriceActual
- actual price
-
setPrice
public void setPrice()
Set Price for Product and PriceList. Use only if newly created. Uses standard price list of not set by order constructor
-
setPrice
public void setPrice(int M_PriceList_ID)
Set Price for Product and PriceList- Parameters:
M_PriceList_ID
- price list
-
getProductPricing
protected IProductPricing getProductPricing(int M_PriceList_ID)
Get and calculate Product Pricing- Parameters:
M_PriceList_ID
- id- Returns:
- product pricing
-
setTax
public boolean setTax()
Set Tax- Returns:
- true if tax is set
-
setLineNetAmt
public void setLineNetAmt()
Calculate Extended Amt. May or may not include tax
-
getCharge
public MCharge getCharge()
Get Charge- Returns:
- product or null
-
getTax
protected MTax getTax()
Get Tax (immutable)- Returns:
- tax
-
getPrecision
public int getPrecision()
Get Currency Precision from Currency- Returns:
- precision
-
setProduct
public void setProduct(MProduct product)
Set Product- Parameters:
product
- product
-
setM_Product_ID
public void setM_Product_ID(int M_Product_ID, boolean setUOM)
Set M_Product_ID- Parameters:
M_Product_ID
- productsetUOM
- set also UOM
-
setM_Product_ID
public void setM_Product_ID(int M_Product_ID, int C_UOM_ID)
Set Product and UOM- Parameters:
M_Product_ID
- productC_UOM_ID
- uom
-
getProduct
public MProduct getProduct()
Get Product- Returns:
- product or null
-
setM_AttributeSetInstance_ID
public void setM_AttributeSetInstance_ID(int M_AttributeSetInstance_ID)
Set M_AttributeSetInstance_ID- Specified by:
setM_AttributeSetInstance_ID
in interfaceI_C_OrderLine
- Overrides:
setM_AttributeSetInstance_ID
in classX_C_OrderLine
- Parameters:
M_AttributeSetInstance_ID
- id
-
setM_Warehouse_ID
public void setM_Warehouse_ID(int M_Warehouse_ID)
Set Warehouse- Specified by:
setM_Warehouse_ID
in interfaceI_C_OrderLine
- Overrides:
setM_Warehouse_ID
in classX_C_OrderLine
- Parameters:
M_Warehouse_ID
- warehouse
-
canChangeWarehouse
public boolean canChangeWarehouse()
Can Change Warehouse- Returns:
- true if warehouse can be changed
-
getC_Project_ID
public int getC_Project_ID()
Get C_Project_ID- Specified by:
getC_Project_ID
in interfaceI_C_OrderLine
- Overrides:
getC_Project_ID
in classX_C_OrderLine
- Returns:
- project
-
getC_Activity_ID
public int getC_Activity_ID()
Get C_Activity_ID- Specified by:
getC_Activity_ID
in interfaceI_C_OrderLine
- Overrides:
getC_Activity_ID
in classX_C_OrderLine
- Returns:
- Activity
-
getC_Campaign_ID
public int getC_Campaign_ID()
Get C_Campaign_ID- Specified by:
getC_Campaign_ID
in interfaceI_C_OrderLine
- Overrides:
getC_Campaign_ID
in classX_C_OrderLine
- Returns:
- Campaign
-
getUser1_ID
public int getUser1_ID()
Get User2_ID- Specified by:
getUser1_ID
in interfaceI_C_OrderLine
- Overrides:
getUser1_ID
in classX_C_OrderLine
- Returns:
- User2
-
getUser2_ID
public int getUser2_ID()
Get User2_ID- Specified by:
getUser2_ID
in interfaceI_C_OrderLine
- Overrides:
getUser2_ID
in classX_C_OrderLine
- Returns:
- User2
-
getAD_OrgTrx_ID
public int getAD_OrgTrx_ID()
Get AD_OrgTrx_ID- Specified by:
getAD_OrgTrx_ID
in interfaceI_C_OrderLine
- Overrides:
getAD_OrgTrx_ID
in classX_C_OrderLine
- Returns:
- trx org
-
toString
public String toString()
String Representation- Overrides:
toString
in classX_C_OrderLine
- Returns:
- info
-
addDescription
public void addDescription(String description)
Add to Description- Parameters:
description
- text
-
getDescriptionText
public String getDescriptionText()
Get Description Text. For jsp access (vs. isDescription)- Returns:
- description
-
getName
public String getName()
Get Name- Returns:
- get the name of the line (from Product)
-
setC_Charge_ID
public void setC_Charge_ID(int C_Charge_ID)
Set C_Charge_ID- Specified by:
setC_Charge_ID
in interfaceI_C_OrderLine
- Overrides:
setC_Charge_ID
in classX_C_OrderLine
- Parameters:
C_Charge_ID
- charge
-
setDiscount
public void setDiscount()
Set Discount
-
isTaxIncluded
public boolean isTaxIncluded()
Is Tax Included in Amount- Returns:
- true if tax calculated
-
setQty
public void setQty(BigDecimal Qty)
Set Qty Entered/Ordered. Use this Method if the Line UOM is the Product UOM- Parameters:
Qty
- QtyOrdered/Entered
-
setQtyEntered
public void setQtyEntered(BigDecimal QtyEntered)
Set Qty Entered - enforce entered UOM- Specified by:
setQtyEntered
in interfaceI_C_OrderLine
- Overrides:
setQtyEntered
in classX_C_OrderLine
- Parameters:
QtyEntered
-
-
setQtyOrdered
public void setQtyOrdered(BigDecimal QtyOrdered)
Set Qty Ordered - enforce Product UOM- Specified by:
setQtyOrdered
in interfaceI_C_OrderLine
- Overrides:
setQtyOrdered
in classX_C_OrderLine
- Parameters:
QtyOrdered
-
-
getBase
public BigDecimal getBase(String CostDistribution)
Get Base value for Cost Distribution- Parameters:
CostDistribution
- cost Distribution- Returns:
- base number
-
beforeSave
protected boolean beforeSave(boolean newRecord)
Before Save- Overrides:
beforeSave
in classPO
- Parameters:
newRecord
-- Returns:
- true if it can be saved
-
beforeDelete
protected boolean beforeDelete()
Before Delete- Overrides:
beforeDelete
in classPO
- Returns:
- true if it can be deleted
-
afterSave
protected boolean afterSave(boolean newRecord, boolean success)
After Save
-
afterDelete
protected boolean afterDelete(boolean success)
After Delete- Overrides:
afterDelete
in classPO
- Parameters:
success
- success- Returns:
- deleted
-
updateOrderTax
public boolean updateOrderTax(boolean oldTax)
Recalculate order tax- Parameters:
oldTax
- true if the old C_Tax_ID should be used- Returns:
- true if success, false otherwise author teo_sarca [ 1583825 ]
-
updateHeaderTax
public boolean updateHeaderTax()
Update Tax and Header- Returns:
- true if header updated
-
clearParent
public void clearParent()
-
-