Fixed bug 30021: Requisition To Order with several secondary UOMs per product
authorVíctor Martínez Romanos <victor.martinez@openbravo.com>
Wed, 27 May 2015 09:44:35 +0200
changeset 26783 ed79488b19b5
parent 26782 f8b937eb67f2
child 26784 9c4cd496fbbf
Fixed bug 30021: Requisition To Order with several secondary UOMs per product

The system was grouping requisition lines by product without taking into account the secondary UOM.
Now the code takes into account the M_Product_UOM_Id column too to group/split the purchase order line.
src/org/openbravo/erpCommon/ad_forms/RequisitionToOrder.java
src/org/openbravo/erpCommon/ad_forms/RequisitionToOrder_data.xsql
--- a/src/org/openbravo/erpCommon/ad_forms/RequisitionToOrder.java	Tue May 26 18:20:34 2015 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/RequisitionToOrder.java	Wed May 27 09:44:35 2015 +0200
@@ -28,6 +28,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.commons.lang.StringUtils;
 import org.openbravo.base.filter.IsIDFilter;
 import org.openbravo.base.secureApp.HttpSecureAppServlet;
 import org.openbravo.base.secureApp.VariablesSecureApp;
@@ -551,7 +552,8 @@
         } else if (!lines[i + 1].mProductId.equals(lines[i].mProductId)
             || !lines[i + 1].mAttributesetinstanceId.equals(lines[i].mAttributesetinstanceId)
             || !lines[i + 1].description.equals(lines[i].description)
-            || !lines[i + 1].priceactual.equals(lines[i].priceactual)) {
+            || !lines[i + 1].priceactual.equals(lines[i].priceactual)
+            || !StringUtils.equals(lines[i + 1].mProductUomId, lines[i].mProductUomId)) {
           insertLine = true;
           qtyOrder = qty;
           qty = new BigDecimal(0);
--- a/src/org/openbravo/erpCommon/ad_forms/RequisitionToOrder_data.xsql	Tue May 26 18:20:34 2015 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/RequisitionToOrder_data.xsql	Wed May 27 09:44:35 2015 +0200
@@ -176,7 +176,7 @@
 	    M_PRODUCT_UOM_ID, M_REQUISITIONLINE_ID, M_PRODUCTPRICE.PRICELIST, M_REQUISITIONLINE.PRICELIST, LOCKPRICE,
 	    M_PRODUCTPRICE.PRICELIMIT, M_PRODUCTPRICE.PRICESTD, M_Pricelist.istaxincluded, M_REQUISITIONLINE.needbydate,
             M_REQUISITIONLINE.QTY, M_REQUISITIONLINE.ORDEREDQTY, SUPPLIERNOTES
-        ORDER BY MIN(M_REQUISITIONLINE.LINE), M_REQUISITIONLINE.M_PRODUCT_ID, M_ATTRIBUTESETINSTANCE_ID, SUPPLIERNOTES, 
+        ORDER BY MIN(M_REQUISITIONLINE.LINE), M_REQUISITIONLINE.M_PRODUCT_ID, M_PRODUCT_UOM_ID, M_ATTRIBUTESETINSTANCE_ID, SUPPLIERNOTES, 
                  ROUND(COALESCE(LOCKPRICE, M_PRODUCTPRICE.PRICESTD),(SELECT PRICEPRECISION FROM C_CURRENCY WHERE C_CURRENCY_ID = ?))
         ]]></Sql>
     <Field name="rownum" value="count"/>