Fixes issue 31119: Warehouse rules should be adapted to type "Parameter"
authorAlvaro Ferraz <alvaro.ferraz@openbravo.com>
Wed, 04 Nov 2015 21:20:09 +0100
changeset 27840 b0d1b3ab201c
parent 27839 7ba06ba5da79
child 27841 940048b0ab81
Fixes issue 31119: Warehouse rules should be adapted to type "Parameter"

Create new warehouse rule procedures of type Parameter: M_UNIQUEATTRIBUTE_RULE_PARAM, M_UNIQUELOCATOR_RULE_PARAM, M_WAREHOUSE_DEFAULT_RULE_PARAM.
Deprecate old warehouse rule procedures of type PInstance: M_UNIQUEATTRIBUTE_RULE, M_UNIQUELOCATOR_RULE, M_WAREHOUSE_DEFAULT_RULE.
Update warehouse rules in F&B International Group and QA Testing clients to the new ones.
referencedata/sampledata/F_B_International_Group/M_WAREHOUSE_RULE.xml
referencedata/sampledata/QA_Testing/M_WAREHOUSE_RULE.xml
src-db/database/model/functions/M_UNIQUEATTRIBUTE_RULE.xml
src-db/database/model/functions/M_UNIQUEATTRIBUTE_RULE_PARAM.xml
src-db/database/model/functions/M_UNIQUELOCATOR_RULE.xml
src-db/database/model/functions/M_UNIQUELOCATOR_RULE_PARAM.xml
src-db/database/model/functions/M_WAREHOUSE_DEFAULT_RULE.xml
src-db/database/model/functions/M_WAREHOUSE_DEFAULT_RULE_PARAM.xml
--- a/referencedata/sampledata/F_B_International_Group/M_WAREHOUSE_RULE.xml	Thu Nov 05 18:24:21 2015 +0100
+++ b/referencedata/sampledata/F_B_International_Group/M_WAREHOUSE_RULE.xml	Wed Nov 04 21:20:09 2015 +0100
@@ -7,12 +7,12 @@
   <ISACTIVE><![CDATA[Y]]></ISACTIVE>
   <CREATED><![CDATA[2013-07-04 23:45:49.049]]></CREATED>
   <CREATEDBY><![CDATA[0]]></CREATEDBY>
-  <UPDATED><![CDATA[2013-07-04 23:45:49.049]]></UPDATED>
-  <UPDATEDBY><![CDATA[0]]></UPDATEDBY>
+  <UPDATED><![CDATA[2015-11-04 16:34:07.922]]></UPDATED>
+  <UPDATEDBY><![CDATA[100]]></UPDATEDBY>
   <NAME><![CDATA[Default Warehouse Rule]]></NAME>
-  <PROCEDURENAME><![CDATA[M_WAREHOUSE_DEFAULT_RULE]]></PROCEDURENAME>
+  <PROCEDURENAME><![CDATA[M_WAREHOUSE_DEFAULT_RULE_PARAM]]></PROCEDURENAME>
   <DESCRIPTION><![CDATA[Useful to overwrite a warehouse rule defined at warehouse on specific documents.]]></DESCRIPTION>
-  <TYPE><![CDATA[I]]></TYPE>
+  <TYPE><![CDATA[P]]></TYPE>
 </M_WAREHOUSE_RULE>
 
 <M_WAREHOUSE_RULE>
@@ -22,12 +22,12 @@
   <ISACTIVE><![CDATA[Y]]></ISACTIVE>
   <CREATED><![CDATA[2013-07-04 23:45:49.049]]></CREATED>
   <CREATEDBY><![CDATA[0]]></CREATEDBY>
-  <UPDATED><![CDATA[2013-07-04 23:45:49.049]]></UPDATED>
-  <UPDATEDBY><![CDATA[0]]></UPDATEDBY>
+  <UPDATED><![CDATA[2015-11-04 16:34:13.571]]></UPDATED>
+  <UPDATEDBY><![CDATA[100]]></UPDATEDBY>
   <NAME><![CDATA[Unique Attribute]]></NAME>
-  <PROCEDURENAME><![CDATA[M_UNIQUEATTRIBUTE_RULE]]></PROCEDURENAME>
+  <PROCEDURENAME><![CDATA[M_UNIQUEATTRIBUTE_RULE_PARAM]]></PROCEDURENAME>
   <DESCRIPTION><![CDATA[Returns stock of the first attribute set instance in the warehouse with enough stock.]]></DESCRIPTION>
-  <TYPE><![CDATA[I]]></TYPE>
+  <TYPE><![CDATA[P]]></TYPE>
 </M_WAREHOUSE_RULE>
 
 <M_WAREHOUSE_RULE>
@@ -37,12 +37,12 @@
   <ISACTIVE><![CDATA[Y]]></ISACTIVE>
   <CREATED><![CDATA[2013-07-04 23:45:49.049]]></CREATED>
   <CREATEDBY><![CDATA[0]]></CREATEDBY>
-  <UPDATED><![CDATA[2013-07-04 23:45:49.049]]></UPDATED>
-  <UPDATEDBY><![CDATA[0]]></UPDATEDBY>
+  <UPDATED><![CDATA[2015-11-04 16:34:19.71]]></UPDATED>
+  <UPDATEDBY><![CDATA[100]]></UPDATEDBY>
   <NAME><![CDATA[Unique Storage Bin]]></NAME>
-  <PROCEDURENAME><![CDATA[M_UNIQUELOCATOR_RULE]]></PROCEDURENAME>
+  <PROCEDURENAME><![CDATA[M_UNIQUELOCATOR_RULE_PARAM]]></PROCEDURENAME>
   <DESCRIPTION><![CDATA[Returns stock of the first storage bin in the warehouse with enough stock.]]></DESCRIPTION>
-  <TYPE><![CDATA[I]]></TYPE>
+  <TYPE><![CDATA[P]]></TYPE>
 </M_WAREHOUSE_RULE>
 
 </data>
--- a/referencedata/sampledata/QA_Testing/M_WAREHOUSE_RULE.xml	Thu Nov 05 18:24:21 2015 +0100
+++ b/referencedata/sampledata/QA_Testing/M_WAREHOUSE_RULE.xml	Wed Nov 04 21:20:09 2015 +0100
@@ -10,9 +10,9 @@
   <UPDATED><![CDATA[2013-07-04 23:38:18.243]]></UPDATED>
   <UPDATEDBY><![CDATA[0]]></UPDATEDBY>
   <NAME><![CDATA[Unique Storage Bin]]></NAME>
-  <PROCEDURENAME><![CDATA[M_UNIQUELOCATOR_RULE]]></PROCEDURENAME>
+  <PROCEDURENAME><![CDATA[M_UNIQUELOCATOR_RULE_PARAM]]></PROCEDURENAME>
   <DESCRIPTION><![CDATA[Returns stock of the first storage bin in the warehouse with enough stock.]]></DESCRIPTION>
-  <TYPE><![CDATA[I]]></TYPE>
+  <TYPE><![CDATA[P]]></TYPE>
 </M_WAREHOUSE_RULE>
 
 <M_WAREHOUSE_RULE>
@@ -25,9 +25,9 @@
   <UPDATED><![CDATA[2013-07-04 23:38:18.243]]></UPDATED>
   <UPDATEDBY><![CDATA[0]]></UPDATEDBY>
   <NAME><![CDATA[Unique Attribute]]></NAME>
-  <PROCEDURENAME><![CDATA[M_UNIQUEATTRIBUTE_RULE]]></PROCEDURENAME>
+  <PROCEDURENAME><![CDATA[M_UNIQUEATTRIBUTE_RULE_PARAM]]></PROCEDURENAME>
   <DESCRIPTION><![CDATA[Returns stock of the first attribute set instance in the warehouse with enough stock.]]></DESCRIPTION>
-  <TYPE><![CDATA[I]]></TYPE>
+  <TYPE><![CDATA[P]]></TYPE>
 </M_WAREHOUSE_RULE>
 
 <M_WAREHOUSE_RULE>
@@ -40,9 +40,9 @@
   <UPDATED><![CDATA[2013-07-04 23:38:18.243]]></UPDATED>
   <UPDATEDBY><![CDATA[0]]></UPDATEDBY>
   <NAME><![CDATA[Default Warehouse Rule]]></NAME>
-  <PROCEDURENAME><![CDATA[M_WAREHOUSE_DEFAULT_RULE]]></PROCEDURENAME>
+  <PROCEDURENAME><![CDATA[M_WAREHOUSE_DEFAULT_RULE_PARAM]]></PROCEDURENAME>
   <DESCRIPTION><![CDATA[Useful to overwrite a warehouse rule defined at warehouse on specific documents.]]></DESCRIPTION>
-  <TYPE><![CDATA[I]]></TYPE>
+  <TYPE><![CDATA[P]]></TYPE>
 </M_WAREHOUSE_RULE>
 
 </data>
--- a/src-db/database/model/functions/M_UNIQUEATTRIBUTE_RULE.xml	Thu Nov 05 18:24:21 2015 +0100
+++ b/src-db/database/model/functions/M_UNIQUEATTRIBUTE_RULE.xml	Wed Nov 04 21:20:09 2015 +0100
@@ -19,10 +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) 2012 Openbravo SLU
+* All portions are Copyright (C) 2012-2015 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
+/*************************************************************************
+* DEPRECATED: Use m_uniqueattribute_rule_param instead
+************************************************************************/
   v_ResultStr VARCHAR2(2000):='';
   v_Message VARCHAR2(2000):='';
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-db/database/model/functions/M_UNIQUEATTRIBUTE_RULE_PARAM.xml	Wed Nov 04 21:20:09 2015 +0100
@@ -0,0 +1,146 @@
+<?xml version="1.0"?>
+  <database name="FUNCTION M_UNIQUEATTRIBUTE_RULE_PARAM">
+    <function name="M_UNIQUEATTRIBUTE_RULE_PARAM" type="NULL">
+      <parameter name="pinstance_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_clientid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_orgid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_productid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_uomid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_productuomid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_warehouse_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_locatorid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_attributesetinstanceid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_quantity" type="NUMERIC" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_priority_warehouse_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_m_warehouse_rule_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_tableid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_auxid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_lineno" type="NUMERIC" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_m_reservation_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_result" type="NUMERIC" mode="out">
+        <default/>
+      </parameter>
+      <parameter name="p_message" type="VARCHAR" mode="out">
+        <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) 2015 Openbravo SLU
+* All Rights Reserved.
+* Contributor(s):  ______________________________________.
+************************************************************************/
+  v_ResultStr VARCHAR2(2000):='';
+  v_Message VARCHAR2(2000):='';
+
+  TYPE RECORD IS REF CURSOR;
+  Cur_MStock    RECORD;
+
+  v_quantity NUMBER;
+  v_ProductID   VARCHAR2(32);
+  v_SelectedAttSetInstanceID VARCHAR2(32) ;
+  v_ProductName M_Product.NAME%TYPE;
+BEGIN
+
+  v_ResultStr:='ReadingParameters';
+  v_Quantity:=p_quantity;
+  v_ProductID:=p_productid;
+
+  DELETE FROM m_stock_proposed ms
+  WHERE ad_pinstance_id = pinstance_id
+    AND EXISTS (SELECT 1
+                FROM m_storage_detail t
+                WHERE t.m_storage_detail_id = ms.m_storage_detail_id
+                AND t.m_attributesetinstance_id = '0');
+  v_SelectedAttSetInstanceID := NULL;
+
+  FOR Cur_MStock IN (
+      SELECT A.m_attributesetinstance_id
+      FROM (
+        SELECT SUM(ms.quantity) AS qty, t.m_attributesetinstance_id, MIN(priority) AS priority
+        FROM m_stock_proposed ms
+             JOIN m_storage_detail t ON ms.m_storage_detail_id = t.m_storage_detail_id
+        WHERE ad_pinstance_id = pinstance_id
+        GROUP BY t.m_attributesetinstance_id
+        HAVING sum(ms.quantity) >= v_quantity
+        ) A
+      ORDER BY A.priority
+  ) LOOP
+    v_selectedattsetinstanceid := cur_mstock.m_attributesetinstance_id;
+    EXIT;
+  END LOOP;
+
+  DELETE FROM m_stock_proposed
+  WHERE m_stock_proposed_id IN (SELECT m_stock_proposed_id
+                                FROM m_stock_proposed ms
+                                    JOIN m_storage_detail sd ON ms.m_storage_detail_id = sd.m_storage_detail_id
+                                    JOIN m_locator l ON sd.m_locator_id = l.m_locator_id
+                                WHERE ms.ad_pinstance_id = pinstance_id
+                                  AND sd.m_attributesetinstance_id <> COALESCE(v_selectedattsetinstanceid, '-1')
+                                  AND l.m_warehouse_id = p_warehouse_id);
+
+  IF (v_selectedattsetinstanceid IS NULL) THEN
+    SELECT name INTO v_productname
+    FROM m_product
+    WHERE m_product_id = v_productid;
+    v_Message := '@Product@: ' || v_productname ||'. @NotEnoughAttUniqueStock@';
+    p_message:=v_Message;
+    p_result:=0;
+    RETURN;
+  END IF;
+
+  p_message:=v_ResultStr;
+  p_result:=1;
+  RETURN;
+  
+EXCEPTION
+WHEN OTHERS THEN
+  v_ResultStr:= '@ERROR=' || SQLERRM;
+  p_message:=v_ResultStr;
+  p_result:=0;
+  RETURN;
+END M_UNIQUEATTRIBUTE_RULE_PARAM
+]]></body>
+    </function>
+  </database>
--- a/src-db/database/model/functions/M_UNIQUELOCATOR_RULE.xml	Thu Nov 05 18:24:21 2015 +0100
+++ b/src-db/database/model/functions/M_UNIQUELOCATOR_RULE.xml	Wed Nov 04 21:20:09 2015 +0100
@@ -19,10 +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) 2012 Openbravo SLU
+* All portions are Copyright (C) 2012-2015 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
+/*************************************************************************
+* DEPRECATED: Use m_uniquelocator_rule_param instead
+************************************************************************/
   v_ResultStr VARCHAR2(2000):='';
   v_Message VARCHAR2(2000):='';
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-db/database/model/functions/M_UNIQUELOCATOR_RULE_PARAM.xml	Wed Nov 04 21:20:09 2015 +0100
@@ -0,0 +1,142 @@
+<?xml version="1.0"?>
+  <database name="FUNCTION M_UNIQUELOCATOR_RULE_PARAM">
+    <function name="M_UNIQUELOCATOR_RULE_PARAM" type="NULL">
+      <parameter name="pinstance_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_clientid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_orgid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_productid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_uomid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_productuomid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_warehouse_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_locatorid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_attributesetinstanceid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_quantity" type="NUMERIC" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_priority_warehouse_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_m_warehouse_rule_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_tableid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_auxid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_lineno" type="NUMERIC" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_m_reservation_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_result" type="NUMERIC" mode="out">
+        <default/>
+      </parameter>
+      <parameter name="p_message" type="VARCHAR" mode="out">
+        <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) 2015 Openbravo SLU
+* All Rights Reserved.
+* Contributor(s):  ______________________________________.
+************************************************************************/
+  v_ResultStr VARCHAR2(2000):='';
+  v_Message VARCHAR2(2000):='';
+
+  TYPE RECORD IS REF CURSOR;
+  Cur_MStock    RECORD;
+
+  v_quantity NUMBER;
+  v_ProductID   VARCHAR2(32);
+  v_SelectedLocatorID VARCHAR2(32) ;
+  v_ProductName M_Product.NAME%TYPE;
+BEGIN
+
+  v_ResultStr:='ReadingParameters';
+  v_Quantity:=p_quantity;
+  v_ProductID:=p_productid;
+
+  FOR Cur_MStock IN (
+      SELECT sum(ms.quantity) AS qty, t.m_locator_id, MIN(priority) AS priority
+      FROM m_stock_proposed ms
+           JOIN m_storage_detail t ON ms.m_storage_detail_id = t.m_storage_detail_id
+           JOIN m_locator l ON t.m_locator_id = l.m_locator_id
+      WHERE ad_pinstance_id = pinstance_id
+        AND l.m_warehouse_id = p_warehouse_id
+      GROUP BY t.m_locator_id
+      HAVING sum(ms.quantity) >= v_quantity
+      ORDER BY MIN(ms.priority)
+  ) LOOP
+    v_selectedlocatorid := cur_mstock.m_locator_id;
+    EXIT;
+  END LOOP;
+
+  IF (v_selectedlocatorid IS NOT NULL) THEN
+    DELETE FROM m_stock_proposed
+    WHERE m_stock_proposed_id IN (SELECT m_stock_proposed_id
+                                  FROM m_stock_proposed ms
+                                      JOIN m_storage_detail sd ON ms.m_storage_detail_id = sd.m_storage_detail_id
+                                      JOIN m_locator l ON sd.m_locator_id = l.m_locator_id
+                                  WHERE ms.ad_pinstance_id = pinstance_id
+                                    AND sd.m_locator_id <> COALESCE(v_selectedlocatorid, '-1')
+                                    AND l.m_warehouse_id = p_warehouse_id);
+  ELSE
+    UPDATE m_stock_proposed
+    SET isfinal = 'N'
+    WHERE m_stock_proposed_id IN (SELECT m_stock_proposed_id
+                                  FROM m_stock_proposed ms
+                                      JOIN m_storage_detail sd ON ms.m_storage_detail_id = sd.m_storage_detail_id
+                                      JOIN m_locator l ON sd.m_locator_id = l.m_locator_id
+                                  WHERE ms.ad_pinstance_id = pinstance_id
+                                    AND l.m_warehouse_id = p_warehouse_id);
+    v_Message := '@NotEnoughLocatorUniqueStock@';
+    p_message:=v_Message;
+    p_result:=0;
+    RETURN;
+  END IF;
+
+  p_message:=v_ResultStr;
+  p_result:=1;
+  RETURN;
+  
+EXCEPTION
+WHEN OTHERS THEN
+  v_ResultStr:= '@ERROR=' || SQLERRM;
+  p_message:=v_ResultStr;
+  p_result:=0;
+  RETURN;
+END M_UNIQUELOCATOR_RULE_PARAM
+]]></body>
+    </function>
+  </database>
--- a/src-db/database/model/functions/M_WAREHOUSE_DEFAULT_RULE.xml	Thu Nov 05 18:24:21 2015 +0100
+++ b/src-db/database/model/functions/M_WAREHOUSE_DEFAULT_RULE.xml	Wed Nov 04 21:20:09 2015 +0100
@@ -19,10 +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) 2012 Openbravo SLU
+* All portions are Copyright (C) 2012-2015 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
+/*************************************************************************
+* DEPRECATED: Use m_warehouse_default_rule_param instead
+************************************************************************/
 BEGIN
   /*
   
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-db/database/model/functions/M_WAREHOUSE_DEFAULT_RULE_PARAM.xml	Wed Nov 04 21:20:09 2015 +0100
@@ -0,0 +1,86 @@
+<?xml version="1.0"?>
+  <database name="FUNCTION M_WAREHOUSE_DEFAULT_RULE_PARAM">
+    <function name="M_WAREHOUSE_DEFAULT_RULE_PARAM" type="NULL">
+      <parameter name="pinstance_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_clientid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_orgid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_productid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_uomid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_productuomid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_warehouse_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_locatorid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_attributesetinstanceid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_quantity" type="NUMERIC" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_priority_warehouse_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_m_warehouse_rule_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_tableid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_auxid" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_lineno" type="NUMERIC" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_m_reservation_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_result" type="NUMERIC" mode="out">
+        <default/>
+      </parameter>
+      <parameter name="p_message" type="VARCHAR" mode="out">
+        <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) 2015 Openbravo SLU
+* All Rights Reserved.
+* Contributor(s):  ______________________________________.
+************************************************************************/
+BEGIN
+  /*
+  
+  This rule keeps stock proposed as defaulted by the m_get_stock procedure. It shall be used when it is desired to
+  overwrite a warehouse rule defined at warehouse level.
+  
+  */
+  p_result:=1;
+  RETURN;
+END M_WAREHOUSE_DEFAULT_RULE_PARAM
+]]></body>
+    </function>
+  </database>