Fixes Issue 32323:"Generate invoice from receipt" button is not working
authorAtul Gaware <atul.gaware@openbravo.com>
Wed, 24 Feb 2016 18:05:08 +0530
changeset 28636 85f5f008873a
parent 28635 689c4b6505ea
child 28683 f2e7ebc3ea7f
Fixes Issue 32323:"Generate invoice from receipt" button is not working

In case tax not included in price list, gross std price and list price
was set will null value which is not allowed by db table. now they are
initiated to value zero first.
src-db/database/model/functions/M_INOUT_CREATEINVOICE.xml
--- a/src-db/database/model/functions/M_INOUT_CREATEINVOICE.xml	Thu Feb 25 11:22:36 2016 +0100
+++ b/src-db/database/model/functions/M_INOUT_CREATEINVOICE.xml	Wed Feb 24 18:05:08 2016 +0530
@@ -19,7 +19,7 @@
   * parts created by ComPiere are Copyright (C) ComPiere, Inc.;
   * All Rights Reserved.
   * Contributor(s): Openbravo SLU
-  * Contributions are Copyright (C) 2001-2015 Openbravo, S.L.U.
+  * Contributions are Copyright (C) 2001-2016 Openbravo, S.L.U.
   *
   * Specifically, this derivative work is based upon the following Compiere
   * file and version.
@@ -105,10 +105,10 @@
       v_PriceList NUMBER;
       v_PriceActual NUMBER;
       v_PriceLimit NUMBER;
-      v_gross_unit_price NUMBER;
-      v_line_gross_amount NUMBER;
-      v_grosspricestd NUMBER;
-      v_grosspricelist NUMBER;
+      v_gross_unit_price NUMBER:=0;
+      v_line_gross_amount NUMBER:=0;
+      v_grosspricestd NUMBER:=0;
+      v_grosspricelist NUMBER:=0;
       v_priceprecision NUMBER;
       v_stdprecision NUMBER;
       --
@@ -316,8 +316,12 @@
               v_C_Tax_ID:=C_Gettax(CUR_ShipmentLines.M_Product_ID, CUR_Shipment.MovementDate, CUR_Shipment.AD_Org_ID, CUR_Shipment.M_Warehouse_ID, CUR_Shipment.C_BPartner_Location_ID, CUR_Shipment.C_BPartner_Location_ID, CUR_Shipment.C_Project_ID, 'N') ;
               IF (v_istaxincluded = 'Y') THEN
                 v_gross_unit_price:= v_PriceActual;
+                v_grosspricestd:= v_PriceActual;
+                v_grosspricelist:= v_PriceList;
                 v_line_gross_amount:= ROUND(v_gross_unit_price * CUR_ShipmentLines.MovementQty, v_stdprecision);
                 v_PriceActual:= C_GET_NET_PRICE_FROM_GROSS(v_C_Tax_ID, v_PriceActual, 0, v_priceprecision, 1);
+                v_PriceList:= C_GET_NET_PRICE_FROM_GROSS(v_C_Tax_ID, v_PriceList, 0, v_priceprecision, 1);
+                v_PriceLimit:= C_GET_NET_PRICE_FROM_GROSS(v_C_Tax_ID, v_PriceLimit, 0, v_priceprecision, 1);
                 v_LineNetAmt:= ROUND(v_PriceActual * CUR_ShipmentLines.MovementQty, v_stdprecision);
               ELSE
                 v_PriceActual:=M_Get_Offers_Price(now(), CUR_Shipment.C_BPartner_ID, CUR_ShipmentLines.M_Product_ID, v_PriceActual, CUR_ShipmentLines.MovementQty, v_M_PriceList_ID);