[Logistics] Add new parameter to M_RESERVE_STOCK_AUTO & M_MOVEMENT_POST that allows to reserve certain quantity
authorUnai Martirena <unai.martirena@openbravo.com>
Mon, 21 Mar 2016 17:45:33 +0100
changeset 28833 aace3293b8d7
parent 28832 b6834e184017
child 28834 a504afa60379
[Logistics] Add new parameter to M_RESERVE_STOCK_AUTO & M_MOVEMENT_POST that allows to reserve certain quantity
src-db/database/model/functions/M_RESERVATION_POST.xml
src-db/database/model/functions/M_RESERVE_STOCK_AUTO.xml
src-db/database/model/tables/M_PRODUCT.xml
--- a/src-db/database/model/functions/M_RESERVATION_POST.xml	Wed Mar 16 11:42:09 2016 +0100
+++ b/src-db/database/model/functions/M_RESERVATION_POST.xml	Mon Mar 21 17:45:33 2016 +0100
@@ -13,6 +13,9 @@
       <parameter name="p_user_id" type="VARCHAR" mode="in">
         <default/>
       </parameter>
+      <parameter name="p_qty" type="NUMERIC" mode="in">
+        <default><![CDATA[NULL]]></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
@@ -417,7 +420,7 @@
 
   IF (v_resaction = 'PR') THEN
     -- ADD RESERVED STOCK
-    M_RESERVE_STOCK_AUTO(v_reservation_id, v_user_id, v_message);
+    M_RESERVE_STOCK_AUTO(v_reservation_id, v_user_id, v_message, p_qty);
   END IF;
 
   /* Do not process reservation's with no lines
--- a/src-db/database/model/functions/M_RESERVE_STOCK_AUTO.xml	Wed Mar 16 11:42:09 2016 +0100
+++ b/src-db/database/model/functions/M_RESERVE_STOCK_AUTO.xml	Mon Mar 21 17:45:33 2016 +0100
@@ -10,6 +10,9 @@
       <parameter name="p_reservedqty" type="NUMERIC" mode="out">
         <default/>
       </parameter>
+      <parameter name="p_qty" type="NUMERIC" mode="in">
+        <default><![CDATA[NULL]]></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
@@ -86,6 +89,11 @@
   END; -- End Call M_GET_STOCK
   
   v_pendingqty := v_pendingtoreserveqty;
+  
+  IF (p_qty IS NOT NULL) THEN
+    v_pendingqty := p_qty;
+  END IF;
+  
   FOR cur_stock IN (
     SELECT sp.quantity, sp.m_storage_detail_id, w.isallocated
     FROM m_stock_proposed sp
--- a/src-db/database/model/tables/M_PRODUCT.xml	Wed Mar 16 11:42:09 2016 +0100
+++ b/src-db/database/model/tables/M_PRODUCT.xml	Mon Mar 21 17:45:33 2016 +0100
@@ -377,10 +377,6 @@
         <default><![CDATA[N]]></default>
         <onCreateDefault><![CDATA['N']]></onCreateDefault>
       </column>
-      <column name="UNIQUE_PER_DOCUMENT" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false">
-        <default><![CDATA[N]]></default>
-        <onCreateDefault><![CDATA['N']]></onCreateDefault>
-      </column>
       <column name="RELATEPRODCATTOSERVICE" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false">
         <default/>
         <onCreateDefault/>
@@ -405,6 +401,10 @@
         <default/>
         <onCreateDefault/>
       </column>
+      <column name="UNIQUE_PER_DOCUMENT" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false">
+        <default><![CDATA[N]]></default>
+        <onCreateDefault><![CDATA['N']]></onCreateDefault>
+      </column>
       <foreign-key foreignTable="AD_ORG" name="AD_ORG_MPRODUCT">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>