Fixes ISSUE-44005: Document Sequence refactor project
authorÁlvaro Ferraz <alvaro.ferraz@openbravo.com>
Wed, 13 May 2020 11:49:45 +0200
changeset 37348 31ddb9f97c86
parent 37344 f70123c9b651 (current diff)
parent 37347 7c7a934169b5 (diff)
child 37349 e4c009b8d9c3
Fixes ISSUE 44005: Document Sequence refactor project
--- a/src-db/database/model/tables/C_DOCTYPE.xml	Tue May 12 13:29:11 2020 +0200
+++ b/src-db/database/model/tables/C_DOCTYPE.xml	Wed May 13 11:49:45 2020 +0200
@@ -117,6 +117,14 @@
         <default/>
         <onCreateDefault/>
       </column>
+      <column name="C_DOCTYPESIMPINVOICE_ID" primaryKey="false" required="false" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="C_DOCTYPEAGGRINVOICE_ID" primaryKey="false" required="false" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
       <foreign-key foreignTable="AD_SEQUENCE" name="AD_SEQUENCE_DOCTYPEDOC">
         <reference local="DOCNOSEQUENCE_ID" foreign="AD_SEQUENCE_ID"/>
       </foreign-key>
@@ -144,6 +152,12 @@
       <foreign-key foreignTable="GL_CATEGORY" name="C_DOCTYPE_GL_CATEGORY">
         <reference local="GL_CATEGORY_ID" foreign="GL_CATEGORY_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_DOCTYPE" name="C_DOCTYPEAGGRINVOICE">
+        <reference local="C_DOCTYPEAGGRINVOICE_ID" foreign="C_DOCTYPE_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="C_DOCTYPE" name="C_DOCTYPESIMPINVOICE">
+        <reference local="C_DOCTYPESIMPINVOICE_ID" foreign="C_DOCTYPE_ID"/>
+      </foreign-key>
       <unique name="C_DOCTYPE_NAME">
         <unique-column name="AD_CLIENT_ID"/>
         <unique-column name="AD_ORG_ID"/>
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Tue May 12 13:29:11 2020 +0200
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Wed May 13 11:49:45 2020 +0200
@@ -304478,6 +304478,48 @@
 <!--6C64380C32C24FD2BC24DD16A323E4A4-->  <IS_CHILD_PROPERTY_IN_PARENT><![CDATA[Y]]></IS_CHILD_PROPERTY_IN_PARENT>
 <!--6C64380C32C24FD2BC24DD16A323E4A4--></AD_COLUMN>
 
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3--><AD_COLUMN>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <AD_COLUMN_ID><![CDATA[6C707BB327B44C05ADA9AEC5E51EFFB3]]></AD_COLUMN_ID>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <NAME><![CDATA[C_Doctypesimpinvoice_ID]]></NAME>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <DESCRIPTION><![CDATA[Document type used for simplified invoices generated from this sales document]]></DESCRIPTION>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <HELP><![CDATA[The Document Type for Simplified Invoice indicates the document type that will be used when a simplified invoice is generated from this sales document.
+This field will display only when the base document type is Sales Order.]]></HELP>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <COLUMNNAME><![CDATA[C_Doctypesimpinvoice_ID]]></COLUMNNAME>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <AD_TABLE_ID><![CDATA[217]]></AD_TABLE_ID>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <AD_REFERENCE_ID><![CDATA[18]]></AD_REFERENCE_ID>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <AD_REFERENCE_VALUE_ID><![CDATA[170]]></AD_REFERENCE_VALUE_ID>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <AD_VAL_RULE_ID><![CDATA[CBA25061F3834619B0401E0834F43B2D]]></AD_VAL_RULE_ID>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <SEQNO><![CDATA[101]]></SEQNO>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <AD_ELEMENT_ID><![CDATA[493F9D9DAA1D43CFB96208F1EBFF7422]]></AD_ELEMENT_ID>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <POSITION><![CDATA[30]]></POSITION>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <ALLOWSORTING><![CDATA[Y]]></ALLOWSORTING>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <ALLOWFILTERING><![CDATA[Y]]></ALLOWFILTERING>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <ALLOWED_CROSS_ORG_LINK><![CDATA[N]]></ALLOWED_CROSS_ORG_LINK>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3-->  <IS_CHILD_PROPERTY_IN_PARENT><![CDATA[N]]></IS_CHILD_PROPERTY_IN_PARENT>
+<!--6C707BB327B44C05ADA9AEC5E51EFFB3--></AD_COLUMN>
+
 <!--6C802FA6ECA048DC9AC6A2EB3E794DCA--><AD_COLUMN>
 <!--6C802FA6ECA048DC9AC6A2EB3E794DCA-->  <AD_COLUMN_ID><![CDATA[6C802FA6ECA048DC9AC6A2EB3E794DCA]]></AD_COLUMN_ID>
 <!--6C802FA6ECA048DC9AC6A2EB3E794DCA-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -391322,6 +391364,48 @@
 <!--E65F829C8E0B420A8B6D42A1A2DC9195-->  <IS_CHILD_PROPERTY_IN_PARENT><![CDATA[Y]]></IS_CHILD_PROPERTY_IN_PARENT>
 <!--E65F829C8E0B420A8B6D42A1A2DC9195--></AD_COLUMN>
 
+<!--E67118A61EA74C8BAFA514BC162EA057--><AD_COLUMN>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <AD_COLUMN_ID><![CDATA[E67118A61EA74C8BAFA514BC162EA057]]></AD_COLUMN_ID>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <NAME><![CDATA[C_Doctypeaggrinvoice_ID]]></NAME>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <DESCRIPTION><![CDATA[Document type used for aggregated invoices generated from this sales document]]></DESCRIPTION>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <HELP><![CDATA[The Document Type for Aggregated Invoice indicates the document type that will be used when an aggregated invoice is generated from this sales document.
+This field will display only when the base document type is Sales Order.]]></HELP>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <COLUMNNAME><![CDATA[C_Doctypeaggrinvoice_ID]]></COLUMNNAME>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <AD_TABLE_ID><![CDATA[217]]></AD_TABLE_ID>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <AD_REFERENCE_ID><![CDATA[18]]></AD_REFERENCE_ID>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <AD_REFERENCE_VALUE_ID><![CDATA[170]]></AD_REFERENCE_VALUE_ID>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <AD_VAL_RULE_ID><![CDATA[CBA25061F3834619B0401E0834F43B2D]]></AD_VAL_RULE_ID>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <SEQNO><![CDATA[111]]></SEQNO>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <AD_ELEMENT_ID><![CDATA[B5DA3D56A44F43ABA1A31660800FE8DE]]></AD_ELEMENT_ID>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <POSITION><![CDATA[31]]></POSITION>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <ALLOWSORTING><![CDATA[Y]]></ALLOWSORTING>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <ALLOWFILTERING><![CDATA[Y]]></ALLOWFILTERING>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <ALLOWED_CROSS_ORG_LINK><![CDATA[N]]></ALLOWED_CROSS_ORG_LINK>
+<!--E67118A61EA74C8BAFA514BC162EA057-->  <IS_CHILD_PROPERTY_IN_PARENT><![CDATA[N]]></IS_CHILD_PROPERTY_IN_PARENT>
+<!--E67118A61EA74C8BAFA514BC162EA057--></AD_COLUMN>
+
 <!--E673EE5F3E0741FD97178D4C2994C445--><AD_COLUMN>
 <!--E673EE5F3E0741FD97178D4C2994C445-->  <AD_COLUMN_ID><![CDATA[E673EE5F3E0741FD97178D4C2994C445]]></AD_COLUMN_ID>
 <!--E673EE5F3E0741FD97178D4C2994C445-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_ELEMENT.xml	Tue May 12 13:29:11 2020 +0200
+++ b/src-db/database/sourcedata/AD_ELEMENT.xml	Wed May 13 11:49:45 2020 +0200
@@ -23606,6 +23606,21 @@
 <!--48E5DEEA9B5111DDB37D00014A62838F-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--48E5DEEA9B5111DDB37D00014A62838F--></AD_ELEMENT>
 
+<!--493F9D9DAA1D43CFB96208F1EBFF7422--><AD_ELEMENT>
+<!--493F9D9DAA1D43CFB96208F1EBFF7422-->  <AD_ELEMENT_ID><![CDATA[493F9D9DAA1D43CFB96208F1EBFF7422]]></AD_ELEMENT_ID>
+<!--493F9D9DAA1D43CFB96208F1EBFF7422-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--493F9D9DAA1D43CFB96208F1EBFF7422-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--493F9D9DAA1D43CFB96208F1EBFF7422-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--493F9D9DAA1D43CFB96208F1EBFF7422-->  <COLUMNNAME><![CDATA[C_Doctypesimpinvoice_ID]]></COLUMNNAME>
+<!--493F9D9DAA1D43CFB96208F1EBFF7422-->  <NAME><![CDATA[Document Type for Simplified Invoice]]></NAME>
+<!--493F9D9DAA1D43CFB96208F1EBFF7422-->  <PRINTNAME><![CDATA[Document Type for Simplified Invoice]]></PRINTNAME>
+<!--493F9D9DAA1D43CFB96208F1EBFF7422-->  <DESCRIPTION><![CDATA[Document type used for simplified invoices generated from this sales document]]></DESCRIPTION>
+<!--493F9D9DAA1D43CFB96208F1EBFF7422-->  <HELP><![CDATA[The Document Type for Simplified Invoice indicates the document type that will be used when a simplified invoice is generated from this sales document.
+This field will display only when the base document type is Sales Order.]]></HELP>
+<!--493F9D9DAA1D43CFB96208F1EBFF7422-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--493F9D9DAA1D43CFB96208F1EBFF7422-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--493F9D9DAA1D43CFB96208F1EBFF7422--></AD_ELEMENT>
+
 <!--494B273E7785437DA3437D4F11EACF51--><AD_ELEMENT>
 <!--494B273E7785437DA3437D4F11EACF51-->  <AD_ELEMENT_ID><![CDATA[494B273E7785437DA3437D4F11EACF51]]></AD_ELEMENT_ID>
 <!--494B273E7785437DA3437D4F11EACF51-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -32502,6 +32517,21 @@
 <!--B5B7ECCAA5E40789E040007F01003224-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--B5B7ECCAA5E40789E040007F01003224--></AD_ELEMENT>
 
+<!--B5DA3D56A44F43ABA1A31660800FE8DE--><AD_ELEMENT>
+<!--B5DA3D56A44F43ABA1A31660800FE8DE-->  <AD_ELEMENT_ID><![CDATA[B5DA3D56A44F43ABA1A31660800FE8DE]]></AD_ELEMENT_ID>
+<!--B5DA3D56A44F43ABA1A31660800FE8DE-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--B5DA3D56A44F43ABA1A31660800FE8DE-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--B5DA3D56A44F43ABA1A31660800FE8DE-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--B5DA3D56A44F43ABA1A31660800FE8DE-->  <COLUMNNAME><![CDATA[C_Doctypeagrrinvoice_ID]]></COLUMNNAME>
+<!--B5DA3D56A44F43ABA1A31660800FE8DE-->  <NAME><![CDATA[Document Type for Aggregated Invoice]]></NAME>
+<!--B5DA3D56A44F43ABA1A31660800FE8DE-->  <PRINTNAME><![CDATA[Document Type for Aggregated Invoice]]></PRINTNAME>
+<!--B5DA3D56A44F43ABA1A31660800FE8DE-->  <DESCRIPTION><![CDATA[Document type used for aggregated invoices generated from this sales document]]></DESCRIPTION>
+<!--B5DA3D56A44F43ABA1A31660800FE8DE-->  <HELP><![CDATA[The Document Type for Aggregated Invoice indicates the document type that will be used when an aggregated invoice is generated from this sales document.
+This field will display only when the base document type is Sales Order.]]></HELP>
+<!--B5DA3D56A44F43ABA1A31660800FE8DE-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--B5DA3D56A44F43ABA1A31660800FE8DE-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--B5DA3D56A44F43ABA1A31660800FE8DE--></AD_ELEMENT>
+
 <!--B651D62716A3B629E040007F01004BB7--><AD_ELEMENT>
 <!--B651D62716A3B629E040007F01004BB7-->  <AD_ELEMENT_ID><![CDATA[B651D62716A3B629E040007F01004BB7]]></AD_ELEMENT_ID>
 <!--B651D62716A3B629E040007F01004BB7-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_FIELD.xml	Tue May 12 13:29:11 2020 +0200
+++ b/src-db/database/sourcedata/AD_FIELD.xml	Wed May 13 11:49:45 2020 +0200
@@ -241318,6 +241318,36 @@
 <!--7907EE22A44A4E19AD7CEF8AC5D07DF4-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--7907EE22A44A4E19AD7CEF8AC5D07DF4--></AD_FIELD>
 
+<!--791432D89CAA40D882B91A21852AEE00--><AD_FIELD>
+<!--791432D89CAA40D882B91A21852AEE00-->  <AD_FIELD_ID><![CDATA[791432D89CAA40D882B91A21852AEE00]]></AD_FIELD_ID>
+<!--791432D89CAA40D882B91A21852AEE00-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--791432D89CAA40D882B91A21852AEE00-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--791432D89CAA40D882B91A21852AEE00-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--791432D89CAA40D882B91A21852AEE00-->  <NAME><![CDATA[Document Type for Aggregated Invoice]]></NAME>
+<!--791432D89CAA40D882B91A21852AEE00-->  <DESCRIPTION><![CDATA[Document type used for aggregated invoices generated from this sales document]]></DESCRIPTION>
+<!--791432D89CAA40D882B91A21852AEE00-->  <HELP><![CDATA[The Document Type for Aggregated Invoice indicates the document type that will be used when an aggregated invoice is generated from this sales document.
+This field will display only when the base document type is Sales Order.]]></HELP>
+<!--791432D89CAA40D882B91A21852AEE00-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--791432D89CAA40D882B91A21852AEE00-->  <AD_TAB_ID><![CDATA[167]]></AD_TAB_ID>
+<!--791432D89CAA40D882B91A21852AEE00-->  <AD_COLUMN_ID><![CDATA[E67118A61EA74C8BAFA514BC162EA057]]></AD_COLUMN_ID>
+<!--791432D89CAA40D882B91A21852AEE00-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--791432D89CAA40D882B91A21852AEE00-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--791432D89CAA40D882B91A21852AEE00-->  <DISPLAYLOGIC><![CDATA[@DocBaseType@='SOO'&(@DocSubTypeSO@!'OB')]]></DISPLAYLOGIC>
+<!--791432D89CAA40D882B91A21852AEE00-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--791432D89CAA40D882B91A21852AEE00-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--791432D89CAA40D882B91A21852AEE00-->  <SEQNO><![CDATA[166]]></SEQNO>
+<!--791432D89CAA40D882B91A21852AEE00-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--791432D89CAA40D882B91A21852AEE00-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--791432D89CAA40D882B91A21852AEE00-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--791432D89CAA40D882B91A21852AEE00-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--791432D89CAA40D882B91A21852AEE00-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--791432D89CAA40D882B91A21852AEE00-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--791432D89CAA40D882B91A21852AEE00-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--791432D89CAA40D882B91A21852AEE00-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--791432D89CAA40D882B91A21852AEE00-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--791432D89CAA40D882B91A21852AEE00-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--791432D89CAA40D882B91A21852AEE00--></AD_FIELD>
+
 <!--792DDB29A7624C039B3E1CCF8323F782--><AD_FIELD>
 <!--792DDB29A7624C039B3E1CCF8323F782-->  <AD_FIELD_ID><![CDATA[792DDB29A7624C039B3E1CCF8323F782]]></AD_FIELD_ID>
 <!--792DDB29A7624C039B3E1CCF8323F782-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -285824,6 +285854,36 @@
 <!--B74729322D0B4B56A356E0196DB589C9-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--B74729322D0B4B56A356E0196DB589C9--></AD_FIELD>
 
+<!--B74ABDC0E389465597C8CC37CF8C2B8A--><AD_FIELD>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <AD_FIELD_ID><![CDATA[B74ABDC0E389465597C8CC37CF8C2B8A]]></AD_FIELD_ID>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <NAME><![CDATA[Document Type for Simplified Invoice]]></NAME>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <DESCRIPTION><![CDATA[Document type used for simplified invoices generated from this sales document]]></DESCRIPTION>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <HELP><![CDATA[The Document Type for Simplified Invoice indicates the document type that will be used when a simplified invoice is generated from this sales document.
+This field will display only when the base document type is Sales Order.]]></HELP>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <AD_TAB_ID><![CDATA[167]]></AD_TAB_ID>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <AD_COLUMN_ID><![CDATA[6C707BB327B44C05ADA9AEC5E51EFFB3]]></AD_COLUMN_ID>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <DISPLAYLOGIC><![CDATA[@DocBaseType@='SOO'&(@DocSubTypeSO@!'OB')]]></DISPLAYLOGIC>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <SEQNO><![CDATA[165]]></SEQNO>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--B74ABDC0E389465597C8CC37CF8C2B8A--></AD_FIELD>
+
 <!--B74CB1E3F3CF4097A36379103AD7CBC8--><AD_FIELD>
 <!--B74CB1E3F3CF4097A36379103AD7CBC8-->  <AD_FIELD_ID><![CDATA[B74CB1E3F3CF4097A36379103AD7CBC8]]></AD_FIELD_ID>
 <!--B74CB1E3F3CF4097A36379103AD7CBC8-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
Binary file src-util/modulescript/build/classes/org/openbravo/modulescript/InitializeInvoiceDocumentTypes.class has changed
Binary file src-util/modulescript/build/classes/org/openbravo/modulescript/InitializeInvoiceDocumentTypesData.class has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-util/modulescript/src/org/openbravo/modulescript/InitializeInvoiceDocumentTypes.java	Wed May 13 11:49:45 2020 +0200
@@ -0,0 +1,43 @@
+/*
+ *************************************************************************
+ * 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) 2020 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+package org.openbravo.modulescript;
+
+import org.openbravo.database.ConnectionProvider;
+
+public class InitializeInvoiceDocumentTypes extends ModuleScript {
+
+  @Override
+  public void execute() {
+    try {
+      ConnectionProvider cp = getConnectionProvider();
+      InitializeInvoiceDocumentTypesData.initializeSimplifiedInvoiceDocumentType(cp.getConnection(), cp);
+      InitializeInvoiceDocumentTypesData.initializeAggregatedInvoiceDocumentType(cp.getConnection(), cp);
+    } catch (Exception e) {
+      handleError(e);
+    }
+  }
+
+  @Override
+  protected ModuleScriptExecutionLimits getModuleScriptExecutionLimits() {
+    return new ModuleScriptExecutionLimits("0", null,
+        new OpenbravoVersion(3, 0, 37234));
+  }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-util/modulescript/src/org/openbravo/modulescript/InitializeInvoiceDocumentTypes_data.xsql	Wed May 13 11:49:45 2020 +0200
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+/*
+ *************************************************************************
+ * 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) 2020 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+-->
+<SqlClass name="InitializeInvoiceDocumentTypesData" package="org.openbravo.modulescript">
+  <SqlClassComment></SqlClassComment>
+  <SqlMethod name="dummy" type="preparedStatement" return="multiple">
+    <SqlMethodComment></SqlMethodComment>
+      <Sql>
+        <![CDATA[
+          SELECT 1 AS dummy FROM DUAL
+        ]]>
+      </Sql>
+  </SqlMethod>
+  <SqlMethod name="initializeSimplifiedInvoiceDocumentType" type="preparedStatement" connection="true" return="rowCount">
+    <SqlMethodComment></SqlMethodComment>
+      <Sql>
+        <![CDATA[
+          UPDATE c_doctype
+          SET c_doctypesimpinvoice_id = c_doctypeinvoice_id
+          WHERE c_doctypesimpinvoice_id IS NULL
+        ]]>
+      </Sql>
+  </SqlMethod>
+  <SqlMethod name="initializeAggregatedInvoiceDocumentType" type="preparedStatement" connection="true" return="rowCount">
+    <SqlMethodComment></SqlMethodComment>
+      <Sql>
+        <![CDATA[
+          UPDATE c_doctype
+          SET c_doctypeaggrinvoice_id = c_doctypeinvoice_id
+          WHERE c_doctypeaggrinvoice_id IS NULL
+        ]]>
+      </Sql>
+  </SqlMethod>
+</SqlClass>
--- a/src/org/openbravo/materialmgmt/InvoiceGeneratorFromGoodsShipment.java	Tue May 12 13:29:11 2020 +0200
+++ b/src/org/openbravo/materialmgmt/InvoiceGeneratorFromGoodsShipment.java	Wed May 13 11:49:45 2020 +0200
@@ -11,7 +11,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) 2018-2019 Openbravo SLU
+ * All portions are Copyright (C) 2018-2020 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -77,6 +77,7 @@
   private Invoice invoice;
   private CreateInvoiceLinesFromProcess createInvoiceLineProcess;
   private Date invoiceDate;
+  private String invoiceDocumentNo;
   private String priceListId;
   private final Set<String> ordersWithAfterOrderDeliveryAlreadyInvoiced = new HashSet<>();
   private boolean allowInvoicePOSOrder = false;
@@ -138,10 +139,28 @@
    */
   public InvoiceGeneratorFromGoodsShipment(final String shipmentId, final Date invoiceDate,
       final PriceList priceList) {
+    this(shipmentId, invoiceDate, priceList, null);
+  }
+
+  /**
+   * Creates an {@link InvoiceGeneratorFromGoodsShipment} based on shipment Id
+   * 
+   * @param shipmentId
+   *          The shipment Id
+   * @param invoiceDate
+   *          The invoice date. If null it takes the from the shipment movement date.
+   * @param priceList
+   *          The invoice price list. If null it takes the business partner default
+   * @param invoiceDocumentNo
+   *          The invoice document number.
+   */
+  public InvoiceGeneratorFromGoodsShipment(final String shipmentId, final Date invoiceDate,
+      final PriceList priceList, final String invoiceDocumentNo) {
     Check.isNotNull(shipmentId, "Parameter shipmentId can't be null");
     this.shipmentId = shipmentId;
     setInvoiceDate(invoiceDate);
     setPriceListId(priceList);
+    this.invoiceDocumentNo = invoiceDocumentNo;
     this.createInvoiceLineProcess = WeldUtils
         .getInstanceFromStaticBeanManager(CreateInvoiceLinesFromProcess.class);
   }
@@ -370,7 +389,7 @@
   }
 
   private Invoice createInvoiceHeader() {
-    final Entity invoiceEntity = ModelProvider.getInstance().getEntity(Invoice.class);
+
     final Invoice newInvoice = OBProvider.getInstance().get(Invoice.class);
     final ShipmentInOut shipment = getShipment();
 
@@ -379,14 +398,8 @@
     final DocumentType invoiceDocumentType = getDocumentTypeForARI(getShipment().getOrganization());
     newInvoice.setDocumentType(invoiceDocumentType);
     newInvoice.setTransactionDocument(invoiceDocumentType);
-    String documentNo = Utility.getDocumentNo(OBDal.getInstance().getConnection(false),
-        new DalConnectionProvider(false), RequestContext.get().getVariablesSecureApp(), "",
-        invoiceEntity.getTableName(),
-        newInvoice.getTransactionDocument() == null ? ""
-            : newInvoice.getTransactionDocument().getId(),
-        newInvoice.getDocumentType() == null ? "" : newInvoice.getDocumentType().getId(), false,
-        true);
-    newInvoice.setDocumentNo(documentNo);
+    newInvoice.setDocumentNo(
+        invoiceDocumentNo != null ? invoiceDocumentNo : generateInvoiceDocumentNo(newInvoice));
     newInvoice.setDocumentAction("CO");
     newInvoice.setDocumentStatus("DR");
     newInvoice.setAccountingDate(getInvoiceDate());
@@ -423,6 +436,17 @@
     }
   }
 
+  private String generateInvoiceDocumentNo(final Invoice newInvoice) {
+    final Entity invoiceEntity = ModelProvider.getInstance().getEntity(Invoice.class);
+    return Utility.getDocumentNo(OBDal.getInstance().getConnection(false),
+        new DalConnectionProvider(false), RequestContext.get().getVariablesSecureApp(), "",
+        invoiceEntity.getTableName(),
+        newInvoice.getTransactionDocument() == null ? ""
+            : newInvoice.getTransactionDocument().getId(),
+        newInvoice.getDocumentType() == null ? "" : newInvoice.getDocumentType().getId(), false,
+        true);
+  }
+
   private Currency getCurrency() {
     return (getPriceList() == null) ? null : getPriceList().getCurrency();
   }