fixed issue 24389: [core part] Added a column to skip stock reservations when a transaction is added
authorGuillermo Alvarez de Eulate <guillermo.alvarez@openbravo.com>
Mon, 12 Aug 2013 14:30:33 +0200
changeset 20975 ca15098edeb0
parent 20974 1cb4b186b7c6
child 20976 4080460baf19
fixed issue 24389: [core part] Added a column to skip stock reservations when a transaction is added
src-db/database/model/tables/M_TRANSACTION.xml
src-db/database/model/triggers/M_TRANSACTION_TRG2.xml
src-db/database/sourcedata/AD_COLUMN.xml
src-db/database/sourcedata/AD_ELEMENT.xml
--- a/src-db/database/model/tables/M_TRANSACTION.xml	Mon Aug 12 13:20:58 2013 +0200
+++ b/src-db/database/model/tables/M_TRANSACTION.xml	Mon Aug 12 14:30:33 2013 +0200
@@ -117,6 +117,10 @@
         <default><![CDATA[NC]]></default>
         <onCreateDefault/>
       </column>
+      <column name="ISRESERVATIONTRIGGERDISABLED" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false">
+        <default><![CDATA[N]]></default>
+        <onCreateDefault/>
+      </column>
       <foreign-key foreignTable="M_INTERNAL_CONSUMPTIONLINE" name="M_INTL_CONSUMP_MTRANSACTION">
         <reference local="M_INTERNAL_CONSUMPTIONLINE_ID" foreign="M_INTERNAL_CONSUMPTIONLINE_ID"/>
       </foreign-key>
--- a/src-db/database/model/triggers/M_TRANSACTION_TRG2.xml	Mon Aug 12 13:20:58 2013 +0200
+++ b/src-db/database/model/triggers/M_TRANSACTION_TRG2.xml	Mon Aug 12 14:30:33 2013 +0200
@@ -35,6 +35,10 @@
   END IF;
 
   IF (INSERTING) THEN
+    IF (:NEW.isreservationtriggerdisabled = 'Y') THEN
+      RAISE NOTICE 'skipping reservation check because isreservationtriggerdisabled = Y';
+      RETURN NEW;
+    END IF;
     IF (:NEW.movementqty < 0 AND :NEW.m_product_uom_id IS NULL) THEN
       -- Check reservations. Reserved stock must be released before inserting the transacion.
       SELECT count(1) INTO v_count
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Mon Aug 12 13:20:58 2013 +0200
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Mon Aug 12 14:30:33 2013 +0200
@@ -231627,6 +231627,41 @@
 <!--411B6E7873FC4939906984022DDF9F6D-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
 <!--411B6E7873FC4939906984022DDF9F6D--></AD_COLUMN>
 
+<!--4134E579F126409C920AB9FEBFEF7685--><AD_COLUMN>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <AD_COLUMN_ID><![CDATA[4134E579F126409C920AB9FEBFEF7685]]></AD_COLUMN_ID>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <NAME><![CDATA[Isreservationtriggerdisabled]]></NAME>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <HELP><![CDATA[If active this field skip the trigger which check the stock reservations]]></HELP>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <COLUMNNAME><![CDATA[Isreservationtriggerdisabled]]></COLUMNNAME>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <AD_TABLE_ID><![CDATA[329]]></AD_TABLE_ID>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <DEFAULTVALUE><![CDATA[N]]></DEFAULTVALUE>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <SEQNO><![CDATA[83]]></SEQNO>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <AD_ELEMENT_ID><![CDATA[E7BCD1D77238483FA6C648AD50A1E5B4]]></AD_ELEMENT_ID>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <POSITION><![CDATA[31]]></POSITION>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--4134E579F126409C920AB9FEBFEF7685-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--4134E579F126409C920AB9FEBFEF7685--></AD_COLUMN>
+
 <!--41F88DE1D95E4BDB8EEEEE8C78EA72AA--><AD_COLUMN>
 <!--41F88DE1D95E4BDB8EEEEE8C78EA72AA-->  <AD_COLUMN_ID><![CDATA[41F88DE1D95E4BDB8EEEEE8C78EA72AA]]></AD_COLUMN_ID>
 <!--41F88DE1D95E4BDB8EEEEE8C78EA72AA-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_ELEMENT.xml	Mon Aug 12 13:20:58 2013 +0200
+++ b/src-db/database/sourcedata/AD_ELEMENT.xml	Mon Aug 12 14:30:33 2013 +0200
@@ -31371,6 +31371,19 @@
 <!--E5702FB7A0A14BF782A5723A131B8F8C-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--E5702FB7A0A14BF782A5723A131B8F8C--></AD_ELEMENT>
 
+<!--E7BCD1D77238483FA6C648AD50A1E5B4--><AD_ELEMENT>
+<!--E7BCD1D77238483FA6C648AD50A1E5B4-->  <AD_ELEMENT_ID><![CDATA[E7BCD1D77238483FA6C648AD50A1E5B4]]></AD_ELEMENT_ID>
+<!--E7BCD1D77238483FA6C648AD50A1E5B4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--E7BCD1D77238483FA6C648AD50A1E5B4-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--E7BCD1D77238483FA6C648AD50A1E5B4-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--E7BCD1D77238483FA6C648AD50A1E5B4-->  <COLUMNNAME><![CDATA[Isreservationtriggerdisabled]]></COLUMNNAME>
+<!--E7BCD1D77238483FA6C648AD50A1E5B4-->  <NAME><![CDATA[Disable reservations trigger]]></NAME>
+<!--E7BCD1D77238483FA6C648AD50A1E5B4-->  <PRINTNAME><![CDATA[Disable reservations trigger]]></PRINTNAME>
+<!--E7BCD1D77238483FA6C648AD50A1E5B4-->  <HELP><![CDATA[If active this field skip the trigger which check the stock reservations]]></HELP>
+<!--E7BCD1D77238483FA6C648AD50A1E5B4-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--E7BCD1D77238483FA6C648AD50A1E5B4-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--E7BCD1D77238483FA6C648AD50A1E5B4--></AD_ELEMENT>
+
 <!--E7D1B98BBBDD491E9AF666B510D61188--><AD_ELEMENT>
 <!--E7D1B98BBBDD491E9AF666B510D61188-->  <AD_ELEMENT_ID><![CDATA[E7D1B98BBBDD491E9AF666B510D61188]]></AD_ELEMENT_ID>
 <!--E7D1B98BBBDD491E9AF666B510D61188-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>