Fixes issue 35491:Error creating an Order from a Requisition To Order.
authorMiguel <martencobasmiguel@gmail.com>
Fri, 10 Mar 2017 11:11:58 -0500
changeset 31682 d45ceafdfe19
parent 31681 df513ce5d089
child 31683 273c24deef8f
Fixes issue 35491:Error creating an Order from a Requisition To Order.

In AUM project the Constraint c_orderline_check1 was modified, to only allow creation
of order lines whith QUANTITYORDER and M_PRODUCT_UOM_ID values null or not null at same time.
When they were created from the Requisition to Order process, the Order line's QUANTITYORDER
was created with 0 in the case it had a NULL value, instead of maintain the value as NULL.
Because of it the constraint was failing because a QUANTITYORDER=0 and a M_PRODUCT_UOM_ID=NULL.

To solve this problem was modified the linesToOrder query in RequisitionToOrder_data.xsql, to
retrieve the correct value of QUANTITYORDER, including NULL if there are no qty in the second
UOM.
src/org/openbravo/erpCommon/ad_forms/RequisitionToOrder_data.xsql
--- a/src/org/openbravo/erpCommon/ad_forms/RequisitionToOrder_data.xsql	Thu Mar 09 14:22:29 2017 -0500
+++ b/src/org/openbravo/erpCommon/ad_forms/RequisitionToOrder_data.xsql	Fri Mar 10 11:11:58 2017 -0500
@@ -12,7 +12,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2008-2016 Openbravo SLU 
+ * All portions are Copyright (C) 2008-2017 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -158,7 +158,7 @@
     <SqlMethodComment></SqlMethodComment>
     <Sql>
       <![CDATA[
-        SELECT M_REQUISITIONLINE.M_PRODUCT_ID, M_ATTRIBUTESETINSTANCE_ID, LOCKQTY, LOCKAUMQTY, M_REQUISITIONLINE.DESCRIPTION, C_UOM_ID, C_AUM, COALESCE(QUANTITYORDER, 0) AS QUANTITYORDER, AUMQTY, M_PRODUCT_UOM_ID,
+        SELECT M_REQUISITIONLINE.M_PRODUCT_ID, M_ATTRIBUTESETINSTANCE_ID, LOCKQTY, LOCKAUMQTY, M_REQUISITIONLINE.DESCRIPTION, C_UOM_ID, C_AUM, COALESCE(QUANTITYORDER, null) AS QUANTITYORDER, AUMQTY, M_PRODUCT_UOM_ID,
           M_REQUISITIONLINE_ID, '' AS C_ORDERLINE_ID,
           COALESCE(M_PRODUCTPRICE.PRICELIST, M_REQUISITIONLINE.PRICELIST, LOCKPRICE) AS PRICELIST,
           COALESCE(M_PRODUCTPRICE.PRICELIMIT, LOCKPRICE) AS PRICELIMIT,