Projects:Accounting Templates/User Manual
The objective of this feature is to allow the end user to easily configure a specific posting logic for a specific table to be executed instead of OB Core posting logic.
To do so instead of modifying the existing xSQL and Java files for each type of document, you need to create their own classes and xSQL for each type of document you want to post differently.
This is extensible so if you have modified the Java files as if you have modified only files xSQL. Also note that if you create your own Java, it is also necessary to create your own xSQL since core xSQL may be private.
If you analyze the existing sources at src/org/openbravo/erpCommon/ad_forms verify that for each Java file that accounts for a document, there is a file with the same name followed by template.
These files define abstract classes with an abstract method. When creating your own classes of accounting, according to the type of document you post, your class must extend the template for the document.
In that class, you should Implement a constructor and the abstract method of the class that extends. In this method, you define the new way in which the document is accounted. Note that this method receives as parameter the original class that already contains all necessary information, but instead of directly refer to its parameters, you should call the parameters with the parameter name followed by method. An example of the class that implements the docBankTemplate: docBank.line (...) docBank.getAccount
Note that in your own class you should import those objects which are needed for example import org.openbravo.erpCommon.ad_forms.Fact; Fact.createLine for posting.
All the classes you want to use in your class must be imported. Another example is org.openbravo.erpCommon.utility.SequenceIdData import; For your records: SequenceIdData.getUUID ();
After you create your own classes for each type of document create a module that contains these classes. After that define the classes in the window Financial Management | | Accounting | | Setup | | Accounting templates In the java class field should put the name of the class including all the package path, eg com.myCompany.erpCommon.ad_forms.Miclase.java
After defining the new classes will only be associated with the new classes to each of the tables to count.
To access this window:
Navigate to Financial Management | | Accounting | | Setup | | General Ledger Configuration >> Active Tables and then select the tables for which you want to change the posting with the new processes defined in the java class. Select from the Accounting Template field the defined class to replace the standard class.
If you navigate to each type of document from each table to see that also accounting behavior can be overwritten by these templates so that you get different behavior for each document related to a given table. For example you could define different classes for different behaviors for each invoice type Credit memo or AR Invoice.
We strongly recommend to create a module containing all these logic a publish it in the forge and central repository for the community to provide feedback but as well for commercial purposes.