details:   https://code.openbravo.com/erp/devel/pi/rev/6d03521c95b4
changeset: 16790:6d03521c95b4
user:      Javier Etxarri <javier.echarri <at> openbravo.com>
date:      Fri Jun 08 09:57:26 2012 +0200
summary:   Fixes issue 20706: To clone sales order is missing the list price 
value

diffstat:

 
modules/org.openbravo.client.application/src/org/openbravo/client/application/businesslogic/CloneOrderActionHandler.java
 |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 59873e199061 -r 6d03521c95b4 
modules/org.openbravo.client.application/src/org/openbravo/client/application/businesslogic/CloneOrderActionHandler.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/businesslogic/CloneOrderActionHandler.java
  Thu Jun 07 18:00:36 2012 +0200
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/businesslogic/CloneOrderActionHandler.java
  Fri Jun 08 09:57:26 2012 +0200
@@ -79,7 +79,10 @@
         objCloneOrdLine.setReservedQuantity(new BigDecimal("0"));
         objCloneOrdLine.setDeliveredQuantity(new BigDecimal("0"));
         objCloneOrdLine.setInvoicedQuantity(new BigDecimal("0"));
-        objCloneOrdLine.setListPrice(bdPriceList);
+        if (!"".equals(bdPriceList) || bdPriceList != null
+            || 
!bdPriceList.equals(BigDecimal.ZERO.setScale(bdPriceList.scale()))) {
+          objCloneOrdLine.setListPrice(bdPriceList);
+        }
         objCloneOrder.getOrderLineList().add(objCloneOrdLine);
         objCloneOrdLine.setSalesOrder(objCloneOrder);
       }
@@ -98,7 +101,7 @@
 
   private String getPriceListVersion(String priceList, String clientId) {
     try {
-      String whereClause = " as plv , PricingPriceList pl where pl.id=plv.id 
and plv.active='Y' and "
+      String whereClause = " as plv left outer join plv.priceList pl where 
plv.active='Y' and plv.active='Y' and "
           + " pl.id = :priceList and plv.client.id = :clientId order by 
plv.validFromDate desc";
 
       OBQuery<PriceListVersion> ppriceListVersion = 
OBDal.getInstance().createQuery(
@@ -135,7 +138,7 @@
   public static BigDecimal getLineNetAmt(String strOrderId) {
 
     BigDecimal bdLineNetAmt = new BigDecimal("0");
-    final String readLineNetAmtHql = " select (ol.lineNetAmount + 
ol.freightAmount + ol.chargeAmount) as LineNetAmt from OrderLine ol where 
ol.salesOrder.id=?";
+    final String readLineNetAmtHql = " select (coalesce(ol.lineNetAmount,0) + 
coalesce(ol.freightAmount,0) + coalesce(ol.chargeAmount,0)) as LineNetAmt from 
OrderLine ol where ol.salesOrder.id=?";
     final Query readLineNetAmtQry = 
OBDal.getInstance().getSession().createQuery(readLineNetAmtHql);
     readLineNetAmtQry.setString(0, strOrderId);
 

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to