IDEMPIERE-5327 Refactoring and clean up of BOM Drop form (#1395)
- Fix unit test
This commit is contained in:
parent
9ed8c950f7
commit
a9068d6a15
|
@ -327,6 +327,22 @@ public class BOMDrop {
|
||||||
this.M_Product_ID = M_Product_ID;
|
this.M_Product_ID = M_Product_ID;
|
||||||
this.qty = qty;
|
this.qty = qty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return M_Product_ID
|
||||||
|
*/
|
||||||
|
public int getM_Product_ID() {
|
||||||
|
return M_Product_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return qty
|
||||||
|
*/
|
||||||
|
public BigDecimal getQty() {
|
||||||
|
return qty;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -39,7 +39,10 @@ import org.compiere.model.MInvoice;
|
||||||
import org.compiere.model.MInvoiceLine;
|
import org.compiere.model.MInvoiceLine;
|
||||||
import org.compiere.model.MOrder;
|
import org.compiere.model.MOrder;
|
||||||
import org.compiere.model.MOrderLine;
|
import org.compiere.model.MOrderLine;
|
||||||
|
import org.compiere.model.MPriceList;
|
||||||
|
import org.compiere.model.MPriceListVersion;
|
||||||
import org.compiere.model.MProduct;
|
import org.compiere.model.MProduct;
|
||||||
|
import org.compiere.model.MProductPrice;
|
||||||
import org.compiere.model.MProject;
|
import org.compiere.model.MProject;
|
||||||
import org.compiere.model.MProjectLine;
|
import org.compiere.model.MProjectLine;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
@ -115,6 +118,18 @@ public class BOMDropFormTest extends AbstractTestCase {
|
||||||
|
|
||||||
assertEquals(8, selectedItems.size(), "Unexpected number of components");
|
assertEquals(8, selectedItems.size(), "Unexpected number of components");
|
||||||
|
|
||||||
|
int priceListId = order.getM_PriceList_ID();
|
||||||
|
MPriceListVersion priceListVersion = MPriceList.get(priceListId).getPriceListVersion(null);
|
||||||
|
for(SelectedItem selectedItem : selectedItems) {
|
||||||
|
MProductPrice pp = MProductPrice.get(Env.getCtx(), priceListVersion.get_ID(), selectedItem.getM_Product_ID(), getTrxName());
|
||||||
|
if (pp == null) {
|
||||||
|
pp = new MProductPrice(Env.getCtx(), 0, getTrxName());
|
||||||
|
pp.setM_PriceList_Version_ID(priceListVersion.get_ID());
|
||||||
|
pp.setM_Product_ID(selectedItem.getM_Product_ID());
|
||||||
|
pp.setPrices(new BigDecimal("1"), new BigDecimal("1"), BigDecimal.ZERO);
|
||||||
|
pp.saveEx();
|
||||||
|
}
|
||||||
|
}
|
||||||
bomDrop.saveOrderLines(order.getC_Order_ID(), selectedItems, getTrxName());
|
bomDrop.saveOrderLines(order.getC_Order_ID(), selectedItems, getTrxName());
|
||||||
|
|
||||||
order.load(getTrxName());
|
order.load(getTrxName());
|
||||||
|
|
Loading…
Reference in New Issue