Fixes Issue 0041334: API Change:Delete obsolete db functions that have been
authorAtul Gaware <atul.gaware@openbravo.com>
Wed, 24 Jul 2019 20:35:16 +0530
changeset 901 f18c6a305e39
parent 900 842556e4f84f
child 902 9323caf4d782
Fixes Issue 0041334: API Change:Delete obsolete db functions that have been
deprecated

** Remove deprecated db functions m_get_offer_price, m_get_offer_std_price,
m_get_offers_price, m_get_offers_std_price, m_warehouse_default_rule,
m_warehouse_default_rule_param
** Remove references of above function from rest of the db functions
** Method GetPriceOfferData.getOffersPriceCurrency is changed
java/reference/java.japi.gz
model/src-db/database/model/functions/C_CREATE_PINVOICE_FROM_OUTS.xml
model/src-db/database/model/functions/C_GENERATEPOFROMPROJECT.xml
model/src-db/database/model/functions/C_GENERATESOFROMPROJECT.xml
model/src-db/database/model/functions/C_GENERATESOFROMPROJECTORDER.xml
model/src-db/database/model/functions/C_GENERATESOFROMPROJECTPHASE.xml
model/src-db/database/model/functions/C_PROJECT_GENERATE.xml
model/src-db/database/model/functions/MRP_PURCHASEORDER.xml
model/src-db/database/model/functions/M_COPY_PRODUCT_TEMPLATE.xml
model/src-db/database/model/functions/M_EXPLODEBOMNOTSTOCK.xml
model/src-db/database/model/functions/M_GET_OFFERS_PRICE.xml
model/src-db/database/model/functions/M_GET_OFFERS_STD_PRICE.xml
model/src-db/database/model/functions/M_GET_OFFER_PRICE.xml
model/src-db/database/model/functions/M_GET_OFFER_STD_PRICE.xml
model/src-db/database/model/functions/M_INOUT_CREATEINVOICE.xml
model/src-db/database/model/functions/M_INVEXPLODEBOMNOTSTOCK.xml
model/src-db/database/model/functions/M_REQUISITION_CREATEPO.xml
Binary file java/reference/java.japi.gz has changed
--- a/model/src-db/database/model/functions/C_CREATE_PINVOICE_FROM_OUTS.xml	Wed Jul 24 12:41:34 2019 +0200
+++ b/model/src-db/database/model/functions/C_CREATE_PINVOICE_FROM_OUTS.xml	Wed Jul 24 20:35:16 2019 +0530
@@ -16,7 +16,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) 2001-2018 Openbravo SLU
+* All portions are Copyright (C) 2001-2019 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
@@ -313,8 +313,8 @@
             now(), v_User_ID, now(), v_User_ID,
             v_Invoice_ID, Cur_Pend.C_OrderLine_ID, Cur_Pend.M_InOutLine_ID,
             v_line, NULL, Cur_Outs.M_Product_ID, v_auxQty,
-            v_priceList, M_Get_Offers_Price(v_DateInvoiced, v_BPartner_ID, Cur_Outs.M_Product_ID, v_priceActual, v_auxQty, Cur_Outs.M_PriceList_ID),
-   v_priceLimit, ROUND(M_Get_Offers_Price(v_DateInvoiced, v_BPartner_ID, Cur_Outs.M_Product_ID, v_priceActual, v_auxQty, Cur_Outs.M_PriceList_ID) *v_auxQty, 2),
+            v_priceList, v_priceActual,
+            v_priceLimit, ROUND(v_priceActual*v_auxQty, 2),
             NULL, 0, Cur_Outs.C_UOM_ID, v_Tax_ID, NULL,
             0, Cur_Outs.M_AttributeSetInstance_ID, 'N',
             Cur_Outs.quantityOrder*(v_auxQty/Cur_Outs.MovementQty), Cur_Outs.M_Product_UOM_ID, v_priceActual,
@@ -348,8 +348,8 @@
             now(), v_User_ID, now(), v_User_ID,
             v_Invoice_ID, NULL, NULL, v_line,
             NULL, Cur_Outs.M_Product_ID, v_auxQty, v_priceList,
-            M_Get_Offers_Price(v_DateInvoiced, v_BPartner_ID, Cur_Outs.M_Product_ID, v_priceActual, v_auxQty, Cur_Outs.M_PriceList_ID), v_priceLimit,
-   ROUND(M_Get_Offers_Price(v_DateInvoiced, v_BPartner_ID, Cur_Outs.M_Product_ID, v_priceActual, v_auxQty, Cur_Outs.M_PriceList_ID) *v_auxQty, 2), NULL,
+            v_priceActual, v_priceLimit,
+            ROUND(v_priceActual*v_auxQty, 2), NULL,
             0, Cur_Outs.C_UOM_ID, v_Tax_ID, NULL,
             0, Cur_Outs.M_AttributeSetInstance_ID, 'N',
             Cur_Outs.quantityOrder*(v_auxQty/Cur_Outs.MovementQty), Cur_Outs.M_Product_UOM_ID, v_priceActual
--- a/model/src-db/database/model/functions/C_GENERATEPOFROMPROJECT.xml	Wed Jul 24 12:41:34 2019 +0200
+++ b/model/src-db/database/model/functions/C_GENERATEPOFROMPROJECT.xml	Wed Jul 24 20:35:16 2019 +0530
@@ -16,7 +16,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) 2001-2016 Openbravo SLU
+* All portions are Copyright (C) 2001-2019 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
@@ -252,7 +252,7 @@
             IF (Cur_SOLINES.priceactual=0) THEN
               Cur_SOLINES.priceactual:=NULL;
             END IF;
-            v_PriceActual := COALESCE(Cur_SOLINES.priceactual,M_Get_Offers_Price(now(), Cur_SO.C_BPARTNER_ID, Cur_SOLINES.M_PRODUCT_ID, v_PriceStd, Cur_SOLINES.Qty, Cur_SO.M_PRICELIST_ID),0);
+            v_PriceActual := COALESCE(Cur_SOLINES.priceactual,v_PriceStd,0);
 
             IF (v_PriceStd IS NULL) THEN
              v_PriceStd :=  v_PriceActual ;
--- a/model/src-db/database/model/functions/C_GENERATESOFROMPROJECT.xml	Wed Jul 24 12:41:34 2019 +0200
+++ b/model/src-db/database/model/functions/C_GENERATESOFROMPROJECT.xml	Wed Jul 24 20:35:16 2019 +0530
@@ -16,7 +16,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) 2001-2016 Openbravo SLU
+* All portions are Copyright (C) 2001-2019 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
@@ -225,7 +225,7 @@
             IF (Cur_SOLINES.priceactual=0) THEN
               Cur_SOLINES.priceactual:=NULL;
             END IF;
-            v_PriceActual := COALESCE(Cur_SOLINES.priceactual,M_Get_Offers_Price(now(), Cur_SO.C_BPARTNER_ID, Cur_SOLINES.M_PRODUCT_ID, v_PriceStd, Cur_SOLINES.Qty, Cur_SO.M_PRICELIST_ID),0);
+            v_PriceActual := COALESCE(Cur_SOLINES.priceactual,v_PriceStd,0);
 
             IF (v_PriceStd IS NULL) THEN
              v_PriceStd :=  v_PriceActual ;
--- a/model/src-db/database/model/functions/C_GENERATESOFROMPROJECTORDER.xml	Wed Jul 24 12:41:34 2019 +0200
+++ b/model/src-db/database/model/functions/C_GENERATESOFROMPROJECTORDER.xml	Wed Jul 24 20:35:16 2019 +0530
@@ -16,7 +16,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) 2001-2013 Openbravo SLU
+* All portions are Copyright (C) 2001-2019 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
@@ -240,9 +240,9 @@
                 SOLINES.M_PRODUCT_ID, v_UOM, 'N', v_AD_User_ID,
                 v_AD_User_ID, 0, NULL, 0,
                 now(), Cur_SO.AD_ORG_ID, NULL, Cur_SO.C_BPARTNER_ID,
-                M_Get_Offers_Price(now(), Cur_SO.C_BPARTNER_ID, SOLINES.M_PRODUCT_ID, v_PriceStd, SOLINES.InvoicedQty,  v_M_PriceList_ID),
+                v_PriceStd,
     C_Gettax(SOLINES.M_PRODUCT_ID, TRUNC(now(), 'DD'), Cur_SO.AD_ORG_ID, Cur_SO.M_WAREHOUSE_ID, Cur_SO.C_BPARTNER_LOCATION_ID, Cur_SO.C_BPARTNER_LOCATION_ID, Cur_SO.C_PROJECT_ID, 'Y'), Cur_SO.C_BPARTNER_LOCATION_ID,
-                (v_PriceList-v_PriceStd) *100/v_PriceList, v_PriceLimit, NULL, (M_Get_Offers_Price(now(), Cur_SO.C_BPARTNER_ID, SOLINES.M_PRODUCT_ID, v_PriceStd, SOLINES.InvoicedQty,  v_M_PriceList_ID) * SOLINES.InvoicedQty),
+                (v_PriceList-v_PriceStd) *100/v_PriceList, v_PriceLimit, NULL, (v_PriceStd * SOLINES.InvoicedQty),
                 NULL, 'N', v_PriceStd
               )
               ;
--- a/model/src-db/database/model/functions/C_GENERATESOFROMPROJECTPHASE.xml	Wed Jul 24 12:41:34 2019 +0200
+++ b/model/src-db/database/model/functions/C_GENERATESOFROMPROJECTPHASE.xml	Wed Jul 24 20:35:16 2019 +0530
@@ -16,7 +16,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) 2001-2016 Openbravo SLU
+* All portions are Copyright (C) 2001-2019 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
@@ -244,7 +244,7 @@
             END IF;
 
             -- Calculate Price Actual
-            v_PriceActual := COALESCE(Cur_SOLINES.priceactual,M_Get_Offers_Price(now(), Cur_SO.C_BPARTNER_ID, Cur_SOLINES.M_PRODUCT_ID, v_PriceStd, Cur_SOLINES.Qty, Cur_SO.M_PRICELIST_ID),0);
+            v_PriceActual := COALESCE(Cur_SOLINES.priceactual,v_PriceStd,0);
 
             IF (v_PriceStd IS NULL) THEN
              v_PriceStd :=  v_PriceActual ;
--- a/model/src-db/database/model/functions/C_PROJECT_GENERATE.xml	Wed Jul 24 12:41:34 2019 +0200
+++ b/model/src-db/database/model/functions/C_PROJECT_GENERATE.xml	Wed Jul 24 20:35:16 2019 +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-2016 Openbravo, S.L.U.
+  * Contributions are Copyright (C) 2001-2019 Openbravo, S.L.U.
   *
   * Specifically, this derivative work is based upon the following Compiere
   * file and version.
@@ -231,7 +231,7 @@
               CUR_Project.DateContract, CUR_PLines.Description, v_M_Warehouse_ID, CUR_PLines.M_Product_ID,
                'N', v_C_UOM_ID, CUR_Project.C_Currency_ID, CUR_PLines.PlannedQty,
               v_PriceList,
-     M_Get_Offers_Price(CUR_Project.DateContract, CUR_Project.C_BPartner_ID, CUR_PLines.M_Product_ID, v_PriceStd, CUR_PLines.PlannedQty,v_M_PriceList_ID), v_PriceLimit, ROUND(CUR_PLines.PlannedQty*M_Get_Offers_Price(CUR_Project.DateContract, CUR_Project.C_BPartner_ID, CUR_PLines.M_Product_ID, v_PriceStd, CUR_PLines.PlannedQty,v_M_PriceList_ID), 2),
+              v_PriceStd, v_PriceLimit, ROUND(CUR_PLines.PlannedQty*v_PriceStd, 2),
               v_Discount,
               v_C_Tax_ID,  --MODIFIED BY F.IRIAZABAL
               CUR_PLines.PlannedQty, v_C_UOM_ID, CUR_PLines.PlannedPrice)
--- a/model/src-db/database/model/functions/MRP_PURCHASEORDER.xml	Wed Jul 24 12:41:34 2019 +0200
+++ b/model/src-db/database/model/functions/MRP_PURCHASEORDER.xml	Wed Jul 24 20:35:16 2019 +0530
@@ -16,7 +16,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) 2001-2017 Openbravo SLU
+* All portions are Copyright (C) 2001-2019 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
@@ -211,7 +211,7 @@
                                     AND plv.AD_Client_ID =v_Client_ID);
 
         SELECT PriceList, PriceStd,
-               M_Get_Offers_Price(v_DateDoc,Cur_workproposal.C_BPartner_ID,Cur_workproposal.M_Product_ID,PriceStd,Cur_workproposal.QTY, Cur_workproposal.PO_PRICELIST_ID),
+               PriceStd,
                PriceLimit
           INTO v_PriceList, v_PriceStd, v_PriceActual, v_PriceLimit
         FROM M_ProductPrice
--- a/model/src-db/database/model/functions/M_COPY_PRODUCT_TEMPLATE.xml	Wed Jul 24 12:41:34 2019 +0200
+++ b/model/src-db/database/model/functions/M_COPY_PRODUCT_TEMPLATE.xml	Wed Jul 24 20:35:16 2019 +0530
@@ -16,7 +16,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) 2001-2016 Openbravo SLU
+* All portions are Copyright (C) 2001-2019 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
@@ -125,7 +125,7 @@
         )
         AND M_PRICELIST_VERSION.M_PRICELIST_ID=v_Mpricelist
         AND M_PRODUCTPRICE.M_PRODUCT_ID=Cur_ProductTemplate.M_PRODUCT_ID;
-      v_Linenetamount:=C_Currency_Round(M_Get_Offers_Price(now(), v_Bpartner, Cur_ProductTemplate.M_Product_ID, v_Pricestd,Cur_ProductTemplate.QTY,v_Mpricelist ) *Cur_ProductTemplate.QTY, v_Currency, NULL) ;
+      v_Linenetamount:=C_Currency_Round(v_Pricestd*Cur_ProductTemplate.QTY, v_Currency, NULL) ;
       SELECT C_Gettax(Cur_ProductTemplate.M_PRODUCT_ID, v_Dateordered, v_org, v_Warehouse, v_BillTo, v_BpartnerLocation, v_projectID, v_Issotrx)
       INTO v_tax
       FROM DUAL;
@@ -175,7 +175,7 @@
           NULL, Cur_ProductTemplate.M_PRODUCT_ID, v_Warehouse, 'N',
           Cur_ProductTemplate.C_UOM_ID, Cur_ProductTemplate.QTY, 0, 0,
           0, NULL, v_Currency, v_Pricelist,
-          M_Get_Offers_Price(now(), v_Bpartner, Cur_ProductTemplate.M_Product_ID, v_Pricestd, Cur_ProductTemplate.QTY, v_Mpricelist), v_Pricelimit, v_Linenetamount, v_Discount,
+          v_Pricestd, v_Pricelimit, v_Linenetamount, v_Discount,
           0, NULL, 0, v_tax,
           NULL, NULL,
           NULL, 'N', NULL, NULL,
--- a/model/src-db/database/model/functions/M_EXPLODEBOMNOTSTOCK.xml	Wed Jul 24 12:41:34 2019 +0200
+++ b/model/src-db/database/model/functions/M_EXPLODEBOMNOTSTOCK.xml	Wed Jul 24 20:35:16 2019 +0530
@@ -19,15 +19,13 @@
 * under the License.
 * The Original Code is Openbravo ERP.
 * The Initial Developer of the Original Code is Openbravo SLU
-* All portions are Copyright (C) 2013-2018 Openbravo SLU
+* All portions are Copyright (C) 2013-2019 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
   -- Logistice
   v_explode CHAR(1);
   v_orderID VARCHAR2(32);
-  v_CBPartner_ID VARCHAR2(32);
-  v_PriceList_ID VARCHAR2(32);
   v_PriceList_Version_ID VARCHAR2(32);
   v_Record_ID VARCHAR2(32);
   v_C_Tax_ID VARCHAR2(32) ;
@@ -78,8 +76,8 @@
     DBMS_OUTPUT.PUT_LINE('  Record_ID=' || v_Record_ID) ;
   BEGIN --BODY
      
-    SELECT C_ORDER.c_order_id, C_ORDER.c_bpartner_id, c_order.M_PriceList_ID, c_orderline.explode
-      INTO v_orderID, v_CBPartner_ID, v_PriceList_ID, v_explode
+    SELECT C_ORDER.c_order_id, c_orderline.explode
+      INTO v_orderID, v_explode
     FROM C_ORDER JOIN m_pricelist ON c_order.m_pricelist_id = m_pricelist.m_pricelist_id JOIN c_orderline ON c_order.c_order_id = c_orderline.c_order_id
     WHERE c_orderline.c_orderline_id=v_Record_ID  FOR UPDATE;
 
@@ -155,8 +153,8 @@
         C_Currency_ID = CUR_BOM_Line.C_Currency_ID;
 
         IF(v_IsTaxIncluded='Y') THEN
-					v_gross_unit_price:=M_Get_Offers_Price(CUR_BOM_Line.DateOrdered, v_CBPartner_ID, CUR_BOM.M_ProductBOM_ID, M_BOM_PriceStd(CUR_BOM.M_ProductBOM_ID, v_PriceList_Version_ID), CUR_BOM_Line.QtyInvoiced*CUR_BOM.BOMQty, v_PriceList_ID);
-					v_gross_price_list:=M_Get_Offers_Price(CUR_BOM_Line.DateOrdered, v_CBPartner_ID, CUR_BOM.M_ProductBOM_ID, M_BOM_PriceList(CUR_BOM.M_ProductBOM_ID, v_PriceList_Version_ID), CUR_BOM_Line.QtyInvoiced*CUR_BOM.BOMQty, v_PriceList_ID);
+					v_gross_unit_price:=M_BOM_PriceStd(CUR_BOM.M_ProductBOM_ID, v_PriceList_Version_ID);
+					v_gross_price_list:=M_BOM_PriceList(CUR_BOM.M_ProductBOM_ID, v_PriceList_Version_ID);
 					v_line_gross_amount:=ROUND(CUR_BOM_Line.QtyOrdered*CUR_BOM.BOMQty*v_gross_unit_price, v_Precision);
 					v_price_actual:=0;
 					v_line_net_amt:=0;
@@ -164,7 +162,7 @@
 					v_gross_unit_price:=0;
 					v_line_gross_amount:=0;
 					v_gross_price_list:=0;
-					v_price_actual:=M_Get_Offers_Price(CUR_BOM_Line.DateOrdered, v_CBPartner_ID, CUR_BOM.M_ProductBOM_ID, M_BOM_PriceStd(CUR_BOM.M_ProductBOM_ID, v_PriceList_Version_ID), CUR_BOM_Line.QtyInvoiced*CUR_BOM.BOMQty, v_PriceList_ID);
+					v_price_actual:=M_BOM_PriceStd(CUR_BOM.M_ProductBOM_ID, v_PriceList_Version_ID);
 					v_line_net_amt:=ROUND(CUR_BOM_Line.QtyOrdered*CUR_BOM.BOMQty*v_gross_unit_price, v_Precision);
 				END IF;				
     
--- a/model/src-db/database/model/functions/M_GET_OFFERS_PRICE.xml	Wed Jul 24 12:41:34 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-<?xml version="1.0"?>
-  <database name="FUNCTION M_GET_OFFERS_PRICE">
-    <function name="M_GET_OFFERS_PRICE" type="NUMERIC">
-      <parameter name="p_date" type="TIMESTAMP" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_bpartner_id" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_product_id" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_pricestd" type="NUMERIC" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_qty" type="NUMERIC" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_pricelist" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <body><![CDATA[/*************************************************************************
-* The contents of this file are subject to the Openbravo  Public  License
-* Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
-* Version 1.1  with a permitted attribution clause; you may not  use this
-* file except in compliance with the License. You  may  obtain  a copy of
-* the License at http://www.openbravo.com/legal/license.html
-* Software distributed under the License  is  distributed  on  an "AS IS"
-* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
-* License for the specific  language  governing  rights  and  limitations
-* under the License.
-* The Original Code is Openbravo ERP.
-* The Initial Developer of the Original Code is Openbravo SLU
-* All portions are Copyright (C) 2001-2006 Openbravo SLU
-* All Rights Reserved.
-* Contributor(s):  ______________________________________.
-************************************************************************/
-/*
-DEPRECATED!
-This function should not be used. Promotions are calcualted by M_Promotion_Calculate
-when posting orders/invoices.
-*/
-BEGIN
-  return p_PriceStd;
-END M_GET_OFFERS_PRICE
-]]></body>
-    </function>
-  </database>
--- a/model/src-db/database/model/functions/M_GET_OFFERS_STD_PRICE.xml	Wed Jul 24 12:41:34 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-<?xml version="1.0"?>
-  <database name="FUNCTION M_GET_OFFERS_STD_PRICE">
-    <function name="M_GET_OFFERS_STD_PRICE" type="NUMERIC">
-      <parameter name="p_bpartner_id" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_priceactual" type="NUMERIC" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_product_id" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_date" type="TIMESTAMP" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_qty" type="NUMERIC" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_pricelist" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <body><![CDATA[/*************************************************************************
-* The contents of this file are subject to the Openbravo  Public  License
-* Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
-* Version 1.1  with a permitted attribution clause; you may not  use this
-* file except in compliance with the License. You  may  obtain  a copy of
-* the License at http://www.openbravo.com/legal/license.html
-* Software distributed under the License  is  distributed  on  an "AS IS"
-* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
-* License for the specific  language  governing  rights  and  limitations
-* under the License.
-* The Original Code is Openbravo ERP.
-* The Initial Developer of the Original Code is Openbravo SLU
-* All portions are Copyright (C) 2001-2006 Openbravo SLU
-* All Rights Reserved.
-* Contributor(s):  ______________________________________.
-************************************************************************/
-/*
-DEPRECATED!
-This function should not be used. Promotions are calcualted by M_Promotion_Calculate
-when posting orders/invoices.
-*/
-BEGIN
-  return p_PriceActual;
-END M_GET_OFFERS_STD_PRICE
-]]></body>
-    </function>
-  </database>
--- a/model/src-db/database/model/functions/M_GET_OFFER_PRICE.xml	Wed Jul 24 12:41:34 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-<?xml version="1.0"?>
-  <database name="FUNCTION M_GET_OFFER_PRICE">
-    <function name="M_GET_OFFER_PRICE" type="NUMERIC">
-      <parameter name="p_offer_id" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_pricestd" type="NUMERIC" mode="in">
-        <default/>
-      </parameter>
-      <body><![CDATA[/*************************************************************************
-* The contents of this file are subject to the Openbravo  Public  License
-* Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
-* Version 1.1  with a permitted attribution clause; you may not  use this
-* file except in compliance with the License. You  may  obtain  a copy of
-* the License at http://www.openbravo.com/legal/license.html
-* Software distributed under the License  is  distributed  on  an "AS IS"
-* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
-* License for the specific  language  governing  rights  and  limitations
-* under the License.
-* The Original Code is Openbravo ERP.
-* The Initial Developer of the Original Code is Openbravo SLU
-* All portions are Copyright (C) 2001-2006 Openbravo SLU
-* All Rights Reserved.
-* Contributor(s):  ______________________________________.
-************************************************************************/
-/*
-DEPRECATED!
-This function should not be used. Promotions are calcualted by M_Promotion_Calculate
-when posting orders/invoices.
-*/
-BEGIN
-  return p_pricestd;
-END M_GET_OFFER_PRICE
-]]></body>
-    </function>
-  </database>
--- a/model/src-db/database/model/functions/M_GET_OFFER_STD_PRICE.xml	Wed Jul 24 12:41:34 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-<?xml version="1.0"?>
-  <database name="FUNCTION M_GET_OFFER_STD_PRICE">
-    <function name="M_GET_OFFER_STD_PRICE" type="NUMERIC">
-      <parameter name="p_offer_id" type="VARCHAR" mode="in">
-        <default/>
-      </parameter>
-      <parameter name="p_priceactual" type="NUMERIC" mode="in">
-        <default/>
-      </parameter>
-      <body><![CDATA[/*************************************************************************
-* The contents of this file are subject to the Openbravo  Public  License
-* Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
-* Version 1.1  with a permitted attribution clause; you may not  use this
-* file except in compliance with the License. You  may  obtain  a copy of
-* the License at http://www.openbravo.com/legal/license.html
-* Software distributed under the License  is  distributed  on  an "AS IS"
-* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
-* License for the specific  language  governing  rights  and  limitations
-* under the License.
-* The Original Code is Openbravo ERP.
-* The Initial Developer of the Original Code is Openbravo SLU
-* All portions are Copyright (C) 2001-2006 Openbravo SLU
-* All Rights Reserved.
-* Contributor(s):  ______________________________________.
-************************************************************************/
-/*
-DEPRECATED!
-This function should not be used. Promotions are calcualted by M_Promotion_Calculate
-when posting orders/invoices.
-*/
-BEGIN
-  return p_PriceActual;
-END M_GET_OFFER_STD_PRICE
-]]></body>
-    </function>
-  </database>
--- a/model/src-db/database/model/functions/M_INOUT_CREATEINVOICE.xml	Wed Jul 24 12:41:34 2019 +0200
+++ b/model/src-db/database/model/functions/M_INOUT_CREATEINVOICE.xml	Wed Jul 24 20:35:16 2019 +0530
@@ -320,8 +320,8 @@
                 v_PriceLimit:= 0;
                 v_LineNetAmt:= 0;
               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);
-                v_LineNetAmt:=ROUND(M_Get_Offers_Price(now(), CUR_Shipment.C_BPartner_ID, CUR_ShipmentLines.M_Product_ID, v_PriceActual, CUR_ShipmentLines.MovementQty, v_M_PriceList_ID) *CUR_ShipmentLines.MovementQty, v_stdprecision) ;
+                v_PriceActual:=v_PriceActual;
+                v_LineNetAmt:=ROUND(v_PriceActual * CUR_ShipmentLines.MovementQty, v_stdprecision) ;
               END IF;
             END IF;
             -- Get UOM + Tax -- VERY simplified, but should work in most cases
--- a/model/src-db/database/model/functions/M_INVEXPLODEBOMNOTSTOCK.xml	Wed Jul 24 12:41:34 2019 +0200
+++ b/model/src-db/database/model/functions/M_INVEXPLODEBOMNOTSTOCK.xml	Wed Jul 24 20:35:16 2019 +0530
@@ -19,15 +19,13 @@
 * under the License.
 * The Original Code is Openbravo ERP.
 * The Initial Developer of the Original Code is Openbravo SLU
-* All portions are Copyright (C) 2013-2015 Openbravo SLU
+* All portions are Copyright (C) 2013-2019 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
   -- Logistice
   v_explode CHAR(1);
   v_invoiceID VARCHAR2(32);
-  v_CBPartner_ID VARCHAR2(32);
-  v_PriceList_ID VARCHAR2(32);
   v_PriceList_Version_ID VARCHAR2(32);
   v_Record_ID VARCHAR2(32);
   v_C_Tax_ID VARCHAR2(32) ;
@@ -44,7 +42,6 @@
   v_isdeferred_inv C_InvoiceLine.IsDeferred%TYPE;
   v_defplantype_inv C_InvoiceLine.DefPlanType%TYPE;
   v_periodnumber_inv C_InvoiceLine.periodnumber%TYPE;
-  v_DateInvoiced DATE;
   v_BaseAmount VARCHAR2(32);
   v_invoiceline_ID VARCHAR2(32);
 
@@ -75,8 +72,8 @@
     DBMS_OUTPUT.PUT_LINE('  Record_ID=' || v_Record_ID) ;
   BEGIN --BODY
      
-    SELECT C_INVOICE.c_invoice_id, C_INVOICE.c_bpartner_id, C_INVOICE.M_PriceList_ID, DATEORDERED, c_invoiceline.explode
-      INTO v_invoiceID, v_CBPartner_ID, v_PriceList_ID, v_DateInvoiced, v_explode
+    SELECT C_INVOICE.c_invoice_id, c_invoiceline.explode
+      INTO v_invoiceID, v_explode
     FROM C_INVOICE JOIN m_pricelist ON C_INVOICE.m_pricelist_id = m_pricelist.m_pricelist_id JOIN c_invoiceline ON C_INVOICE.c_invoice_id = c_invoiceline.c_invoice_id
     WHERE c_invoiceline.c_invoiceline_id=v_Record_ID  FOR UPDATE;
 
@@ -194,9 +191,9 @@
             now(), '0', now(), '0',
             CUR_BOM_Line.C_Invoice_ID, v_Line, CUR_BOM.Description, CUR_BOM.M_ProductBOM_ID,
             CUR_BOM.C_UOM_ID, CUR_BOM_Line.QtyInvoiced*CUR_BOM.BOMQty, M_BOM_PriceList(CUR_BOM.M_ProductBOM_ID, v_PriceList_Version_ID),
-            M_Get_Offers_Price(v_DateInvoiced, v_CBPartner_ID, CUR_BOM.M_ProductBOM_ID, M_BOM_PriceStd(CUR_BOM.M_ProductBOM_ID, v_PriceList_Version_ID),CUR_BOM_Line.QtyInvoiced*CUR_BOM.BOMQty, v_PriceList_ID),
+            M_BOM_PriceStd(CUR_BOM.M_ProductBOM_ID, v_PriceList_Version_ID),
             M_BOM_PriceLimit(CUR_BOM.M_ProductBOM_ID, v_PriceList_Version_ID),
-            M_Get_Offers_Price(v_DateInvoiced, v_CBPartner_ID, CUR_BOM.M_ProductBOM_ID, M_BOM_PriceStd(CUR_BOM.M_ProductBOM_ID, v_PriceList_Version_ID),CUR_BOM_Line.QtyInvoiced*CUR_BOM.BOMQty, v_PriceList_ID) * CUR_BOM_Line.QtyInvoiced*CUR_BOM.BOMQty, CUR_BOM_Line.C_Charge_ID, CUR_BOM_Line.ChargeAmt,
+            M_BOM_PriceStd(CUR_BOM.M_ProductBOM_ID, v_PriceList_Version_ID) * CUR_BOM_Line.QtyInvoiced*CUR_BOM.BOMQty, CUR_BOM_Line.C_Charge_ID, CUR_BOM_Line.ChargeAmt,
             coalesce(v_C_Tax_ID,CUR_BOM_Line.c_tax_id), M_BOM_PriceStd(CUR_BOM.M_ProductBOM_ID, v_PriceList_Version_ID),
             v_isdeferred_inv, v_defplantype_inv, v_periodnumber_inv, v_period_inv,
             CUR_BOM_Line.c_bpartner_id, CUR_BOM_Line.c_project_id, CUR_BOM_Line.c_projectline_id, CUR_BOM_Line.a_asset_id,
--- a/model/src-db/database/model/functions/M_REQUISITION_CREATEPO.xml	Wed Jul 24 12:41:34 2019 +0200
+++ b/model/src-db/database/model/functions/M_REQUISITION_CREATEPO.xml	Wed Jul 24 20:35:16 2019 +0530
@@ -16,7 +16,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-2017 Openbravo SLU
+* All portions are Copyright (C) 2008-2019 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
@@ -232,7 +232,7 @@
       Ad_Sequence_Next('C_OrderLine', v_Client_ID, v_COrderLine_ID);
 
       SELECT pp.PRICELIST, pp.PRICELIMIT, pp.PRICESTD,
-             ROUND(M_GET_OFFERS_PRICE(TO_DATE(p_OrderDate),Cur_Lines.C_BPID,Cur_Lines.M_Product_ID,COALESCE(Cur_Lines.PRICEACTUAL, pp.PRICESTD),Cur_Lines.QTY - Cur_Lines.ORDEREDQTY,Cur_Lines.PRICELIST_ID),CUR.PRICEPRECISION), 
+             ROUND(COALESCE(Cur_Lines.PRICEACTUAL, pp.PRICESTD),CUR.PRICEPRECISION), 
              pp.Gross
         INTO v_PriceList, v_PriceLimit, v_PriceStd, v_PriceActual, v_Gross
       FROM