This tutorial explains how to create a business template with all your code. Business Templates (bt5) are the packaging system of ERP5 and let you easily move and install features from one ERP5 installation to another. In our case we will create the "erp5_discussion" business template.
Now that the forum is functional and secured, we'll want to export it to make it easy to install on other ERP5 instances.
To create the Template for our forum, go to the main page and then My Favourites >> Manage Business Templates. Create a new business template ( Action Menu >> Add Business Template). You will need to fill all the fields of that new object to export your Template. Hopefully for us, ERP5 has mechanisms to assist you in that task. For now, let us just fill the first "View" tab.
Focus on the uppermost section: Name will be the name of your exported template: erp5_forum_tutorial.
In Dependencies you need to list all the business templates your installation depends on, one template name per line. Here, it should list erp5_base, erp5_web, erp5_ingestion_mysql_innodb_catalog, erp5_ingestion and erp5_dms.
Feel free to fill the Version, Description, Comments, Changelog and License accordingly!
Note the Provision field. It's not used in this tutorial, but you will have to think of this field as a way to implement meta templates (in OOP, interfaces): e.g. erp5_mysql_innodb_catalog provides an implementation for the meta template erp5_catalog. erp5_core depends only on the meta template erp5_catalog, leaving the choice of the implementation to users.
Let us complete the rest of the View tab.
Modules should list the module you created: discussion_thread_module.
If you hover on Categories you will see that only base categories should be added here. You haven't created any base category but only subcategories of Function, so leave this field empty.
Skin folders: "erp5_forum", the skin folder you are using.
In Paths add the miscellaneous objects that were not added before. Here, the subcategory forum and its subelements need to be included: add the pattern portal_categories/function/forum**.
Save the template, and go to the Portal Types tab.
ERP5 can guess the Portal Types that an application is using from the module names. Go to Action Menu >> Guess Portal Types from Modules. You will see that the method should have listed in the Portal Types field the three Types you created: Discussion Thread Module, Discussion Thread, and Discussion Post.
Now, instead of filling manually the other properties, hit Action Menu >> Guess Properties of Portal Types. The other necessary fields will then be filled automatically.
Note the Workflow Chains and Actions fields, listing the workflows and actions available for each type.
Go to the Details tab. Portal Types Roles has been filled automatically, meaning that the role definition for these types will be exported. But you will have to write Person and Person Module. In Local Roles field, add discussion_thread_module and person_module, as shown in the screenshot.
Save the object once done.
After you have edited the business template, you can export it in order to install on other ERP5 instances.
Go to Action Menu >> Build Business Template. Then click in the Import/Export button >> Export Business Template.
For more information, please contact Jean-Paul, CEO of Nexedi (+33 629 02 44 25).