<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.infinite-erp.co.id/index.php?action=history&amp;feed=atom&amp;title=How_to_Create_a_Window</id>
	<title>How to Create a Window - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.infinite-erp.co.id/index.php?action=history&amp;feed=atom&amp;title=How_to_Create_a_Window"/>
	<link rel="alternate" type="text/html" href="https://wiki.infinite-erp.co.id/index.php?title=How_to_Create_a_Window&amp;action=history"/>
	<updated>2026-04-06T16:45:43Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.infinite-erp.co.id/index.php?title=How_to_Create_a_Window&amp;diff=45&amp;oldid=prev</id>
		<title>Wikiadmin: Created page with &quot;== Objective ==  The objective of this how-to is to show how you can create a new window from scratch. The how-to build...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.infinite-erp.co.id/index.php?title=How_to_Create_a_Window&amp;diff=45&amp;oldid=prev"/>
		<updated>2018-10-14T13:28:18Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Objective ==  The objective of this how-to is to show how you can create a new &lt;a href=&quot;/index.php?title=Database_Model/org.openbravo.model.ad.ui/AD_Window&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Database Model/org.openbravo.model.ad.ui/AD Window (page does not exist)&quot;&gt;window&lt;/a&gt; from scratch. The how-to build...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Objective ==&lt;br /&gt;
&lt;br /&gt;
The objective of this how-to is to show how you can create a new [[Database_Model/org.openbravo.model.ad.ui/AD_Window |window]] from scratch. The how-to builds on top of two previous how-to's which explained [[How_To_Create_and_Package_a_Module |How to create a module]] and [[How_to_create_a_Table |How to create a table.]] &lt;br /&gt;
&lt;br /&gt;
As a reminder the scenario this is based on:&lt;br /&gt;
&lt;br /&gt;
Imagine we are developing an HR module and we need a window that will enable the user to input salaries of employees. We also need to track the employee's salary so history records need to be preserved. Each salary record needs to have a Valid From Date field that indicates when a particular salary came into being. The record belonging to a particular employee with the latest Valid From Date is the salary that is valid today. Note that employees are already inside the system contained in the C_BPARTNER database table and indicated by the C_BPARTNER.ISMEPLOYEE column. Therefore, we only need to create a database table that will hold the actual salaries.&lt;br /&gt;
&lt;br /&gt;
== Module &amp;amp; Table ==&lt;br /&gt;
&lt;br /&gt;
As mentioned in the objective this tutorial is based on two previous tutorials and assumes that the following objectives have been already completed:&lt;br /&gt;
&lt;br /&gt;
* Creation of a new module with dbprefix ''HT''&lt;br /&gt;
* Creation + Registration in the AD of a new table ''ht_salary''&lt;br /&gt;
&lt;br /&gt;
== Creating the New Window ==&lt;br /&gt;
&lt;br /&gt;
Using the '''''System Administrator''''' role navigate to '''''Application Dictionary || Windows, Tabs and Fields'''''. Create a new record as indicated by the screenshot below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:CreateWindow6_30.png|center]]&lt;br /&gt;
&lt;br /&gt;
Main fields of this window are (for more information see the [[Database_Model/org.openbravo.model.ad.ui/AD_Window |AD_Window]] table description):&lt;br /&gt;
&lt;br /&gt;
* '''Name''' Defines the name that Openbravo ERP uses to recognize this window.&lt;br /&gt;
* '''Description''' Gives a small description of the table.&lt;br /&gt;
* '''Help/Comments''' Defines the text that is displayed in Help window.&lt;br /&gt;
* '''Window Type''' Defines some user interface specifics for a window:&lt;br /&gt;
** ''Maintain'': is used for windows with few entries.&lt;br /&gt;
** ''Transaction'': for transactional windows.&lt;br /&gt;
*** The header tab's underlying table must contain the PROCESSED and UPDATED columns&lt;br /&gt;
*** by default this window filters out old (n days – '''''General Setup &amp;gt; Application &amp;gt; Session Preferences''''' window setting) and processed documents.&lt;br /&gt;
** ''Query Only'': for read-only windows that only enable viewing of data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Save this record and move to '''''Tab''''' tab. Create a new record as shown below, creating the first tab to show the employee information:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:CreateWindow7_30.png|center]]&lt;br /&gt;
&lt;br /&gt;
Main fields of this window are (for more information see the [[Database_Model/org.openbravo.model.ad.ui/AD_Tab |AD_Tab]] table description):&lt;br /&gt;
&lt;br /&gt;
* '''Name''' Defines the name that Openbravo ERP uses to recognize this tab.&lt;br /&gt;
* '''Description''' Gives a small description of the table.&lt;br /&gt;
* '''Help/Comments''' Defines the text that is displayed in Help window.&lt;br /&gt;
* '''Table''' Specifies the table that the tab will show the data from.&lt;br /&gt;
* '''Table Level''' Defines the hierarchy of tabs, ''0'' being the highest level.&lt;br /&gt;
* '''UI Pattern''' This dropdown offers the following options:&lt;br /&gt;
** ''Standard'' - standard interface where multiple records can be added, viewed and edited&lt;br /&gt;
** ''Read Only'' - this option disables any editing/creating capabilities for any user within this tab&lt;br /&gt;
** ''Single Record'' - this option enforces a one-to-one relationship between a parent and a child tab, allowing the user to enter maximum one record in the tab&lt;br /&gt;
* '''HQL Where Clause''' By using this HQL filter, the user will never be able to see data that does not fit the criteria. When referring to properties of the entity shown in the tab then use the prefix '''e'''. In our case, we use this field to display only business partners that are our employees (using the ''employee'' property). &lt;br /&gt;
* '''SQL Where Clause''' Same like HQL Where Clause but using SQL syntax and used for filtering in ''classic windows''.&lt;br /&gt;
&lt;br /&gt;
Save this record and then click the '''''Copy Tab Fields''''' button to copy fields from the existing main tab of the Business Partner window into our new one. Select the ''Business Partner-Business Partner'' ''Tab - Window'' combination and confirm the dialog with OK.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:CreateWindow7.5_30.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Move to '''''Field''''' tab to see all the created fields.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:CreateWindow8_30.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If required, changes to these fields could be made or new ones could be added manually. For not header tabs, it is very important not to remove the field that point the to the ID field of its parent tab, as it would made not possible to create records in this tab using the grid view.  For more information see the [[Database_Model/org.openbravo.model.ad.ui/AD_Field |AD_Field]] table description. However, in our case we are happy with the way they are.&lt;br /&gt;
&lt;br /&gt;
Now, go back to '''''Tab''''' tab and create a new record that will represent the child tab of the Employee tab where salaries will be managed:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:CreateWindow9_30.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Most importantly, make sure you select:&lt;br /&gt;
* '''Table''' = ''HT_Salary''&lt;br /&gt;
* '''Tab Level''' = ''1''&lt;br /&gt;
&lt;br /&gt;
For more information see the [[Database_Model/org.openbravo.model.ad.ui/AD_Tab|AD_Tab]] table description.&lt;br /&gt;
&lt;br /&gt;
By clicking and confirming the '''Create Fields''' dialog, the application will automatically insert the columns of the selected table into the fields tab of the ''Salary'' one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To arrange the columns according to common look and feel of other windows we now change a view field properties as can be seen in following screenshot.&lt;br /&gt;
&lt;br /&gt;
* Hide field ''c_bpartner_id''&lt;br /&gt;
* Reorder fields (using sequence), to have ''isactive'' after all other fields&lt;br /&gt;
* Mark ''amount'' and ''isactive'' as '''Start in new line'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:CreateWindow10_30.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For Openbravo to create links (labels that appear blue) to table elements, the system needs to know which window represents the table where a certain element resides. In our case, the '''Employee Salary''' window is used to manage the content of the '''HT_Salary''' database table. Hence, all salary records need to be shown within that window. To indicate that go to the '''''Application Dictionary || Tables and Columns''''' window, find our HT_Salary table and set the '''Window''' as indicated below:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:CreateWindow11_30.png|center]]&lt;br /&gt;
&lt;br /&gt;
== Creating the Menu Item ==&lt;br /&gt;
&lt;br /&gt;
A menu item is required for the user to be able to call up the new window we developed. Using the System Administrator role navigate to '''''General Setup || Application || Menu''''' and create a new record:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:CreateWindow12_30.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Main fields of this window are (for more information see the [[Database_Model/org.openbravo.model.ad.ui/AD_Menu |AD_Menu]] table description):&lt;br /&gt;
&lt;br /&gt;
* '''Name''' Defines the name that Openbravo ERP uses to recognize this menu item.&lt;br /&gt;
* '''Description''' Gives a small description of the table.&lt;br /&gt;
* '''Summary level''' Defines a folder containing menu items (windows, processes, reports and so on).&lt;br /&gt;
* '''Action''' Defines the type of menu item.&lt;br /&gt;
* '''URL''' If ''Action'' is ''External link'' or ''Internal link'', defines the ''URL'' to be linked.&lt;br /&gt;
* '''Special Form''' If ''Action'' is ''Form'', defines the form to be linked.&lt;br /&gt;
* '''Process''' If ''Action'' is ''Process'', defines the process to be launched.&lt;br /&gt;
* '''Report''' If ''Action'' is ''Report'', defines the report to be linked.&lt;br /&gt;
* '''Window''' If ''Action'' is ''Window'', defines the window to be linked.&lt;br /&gt;
&lt;br /&gt;
Save this record then click on ''Tree'' icon [[Image:CreateWindow13_30.png]].&lt;br /&gt;
&lt;br /&gt;
Here you can drag and drop the new Employee Salary menu item to any of the other menu groups.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:CreateWindow14_30.png|center]]&lt;br /&gt;
&lt;br /&gt;
== Compiling the Application with the New Window ==&lt;br /&gt;
&lt;br /&gt;
Finally, the application needs to be recompiled in order to generate the new window's code and deploy it to Tomcat. If using Eclipse, use the '''eclipse.compile''' ant task, choose '''eclipse.compile''' as Ant Configuration and enter '&amp;quot;Employee Salary&amp;quot;' into the dialog that pops up. If manually compiling Openbravo, use the '''''ant compile.development -Dtab=&amp;quot;Employee Salary&amp;quot;'''''&lt;br /&gt;
&lt;br /&gt;
{{Fancydancy |&lt;br /&gt;
'''Important note''': once the compilation has finished, '''restart Apache Tomcat server'''. In Windows, it is best to stop the Tomcat before running the build task and the start it again afterwards since Windows locks certain files the the ''compile.development'' build task might not be able to copy over.}}&lt;br /&gt;
&lt;br /&gt;
See more on [[Development_Build_Tasks#Build_tasks|Build Tasks]].&lt;br /&gt;
&lt;br /&gt;
== The Result ==&lt;br /&gt;
&lt;br /&gt;
Using the '''''F&amp;amp;B International Group Admin''''' role, select the link to the new window from the menu. Notice the new window and the two tabs hierarchically positioned one above another (one Employe can have one or more salary records):&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:CreateWindow15_30.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
By double clicking Juan Lopez , details of this employee appear, however in a read-only mode (notice all fields are gray). &lt;br /&gt;
&lt;br /&gt;
By clicking 'New in form' while having the ''Salary'' tab in focus a salary record can be created for this employee.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:CreateWindow16_30.png|center]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You have now successfully created your own new window and seen how it came to life within Openbravo ERP. Congratulations!&lt;br /&gt;
&lt;br /&gt;
[[Category:HowTo]]&lt;/div&gt;</summary>
		<author><name>Wikiadmin</name></author>
		
	</entry>
</feed>