Apr 30, 2011

Purpose of Application Element in Openbravo

by Shankar Balachandran

Hi All,
           Application Element is one really cool feature in Openbravo, that I managed to get hold of after a while. But still I feel there is no special interest shown on application element till now. So I just wanted to share the importance and the influence of the application elements as it will cause lots of problems if not handled properly.

            Application Element is mainly used for Re-Usability. It will actually reduce lots of our development time when handled properly. Whenever we create a new column, the synchronize terminology process will create a new application element(if it doesn't have any element for the same column name). Thereafter whenever we create a new column with the same dbname, it will map the same application element for that column. Because of this mapping, we can manage the display name,help/comment, description globally. That is we need not go to each and every column and change the display name,help comment or description. It will be mapped globally to all columns that uses a particular column name. Web Service is one of the most important thing in openbravo. This web service will use the name which we provide as column name in column table.

             A good example could be, think of the column ad_client_id. We should use that field in all tables. Just think what will happen if we need to give the display name, help/comment and description manually for all the tables. Its not just tables, but windows too. As of now, we are not doing that because, we have the application element that is created already for the ad_client_id column that does all these things.All these are possible only when the required application element is in your module or in any module that your module depends on. This can be set in the dependency tab of the module window.

I have attached a screen shot where AD_Client column's name is updated to 'Client' and description and help comment are added by itself. I have also attached the Application Element from which these comments are taken from.









Handling Application Element Properly:

1. Always use the common notation for column names that represents same meaning.
ie., Always remember to check whether we have any column that already have the same name. If exists, use the already existing one.
Eg: If the requirement is to create a field to store begin date, we can give the column name as begin_date, bgn_dt,begin_dt,etc.,  But we already have the column used in many places as begin_date. So use that.
2. Always use the meaningful notation for representing column names.
Eg: Though most people can understand begin_date,begin_dt,bgn_dt,bgn_date represents begin date, begin_date makes more sense.
3. Consider, you added a new column that is not present in the system.
Eg: previous_month
For this column, when you give synchronize terminology, the application element will be created as, Previous_Month. It will displayed in the application element field in the columns as Previous_Month-Previous_Month.
1. Go to Application Dictionary -> Setup -> Element.
2. Search Previous_Month
3. Rename the Name field to Previous Month.
5. Give the description and Help/Comment
4. Rename the Name field to Previous Month in the column window also.
As you can see, you only need to rename the name field in column table. The help comment/Description would have been populated automatically.
Thereafter the same name will be used when ever the same column name is used.

                           In Openbravo, if we have wrong application element,  DAL related process, procedures, callouts, etc(EVERYTHING since openbravo is completely implementing DAL from 3.0), will not work. From a developer's perspective, none of our efforts in writing any code is going to work with improper application element. I just wanted to stress out the need for better care towards it.

                         Thanks to my Colleague Pandi to gather all these points and for stressing to me the need for Application Element that made me to write this blog..:)



Apr 28, 2011

Import Loader Process For Custom Modules

by Shankar Balachandran

Hi All,
The import loader process is used to load data into the openbravo windows from input files. Openbravo has provided the options to load product, business partner, etc., Now we have the option of creating import process for our own modules with a simple java file (Refer here). Right now this process reads data from csv file(The Input format is parsed using the file IdlServiceJava.java file). This can also be extended to read input from other formats by creating a service file similar to IdlServiceJava. The only catch here is that to try this out you need the Professional Subscription, after all not everything comes free in life…:).  I installed the modules, Initial Data Load and Initial Data Load Extension for Java. I used the sample import process that comes along with initial data load extension module and created a new import process for the window frequency.
Here are the steps which I followed.
1. Creating the Java Process file

 package com.fugoconsulting.xyzz.module.template.erpCommon.ad_process;

import org.openbravo.idl.proc.Parameter;
 import org.openbravo.idl.proc.Validator;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.text.ParseException;
 import java.math.BigDecimal;
 import java.util.Date;
 import org.apache.log4j.*;
import org.openbravo.base.exception.OBException;
 import org.openbravo.base.provider.OBProvider;
 import org.openbravo.base.structure.BaseOBObject;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.erpCommon.utility.Utility;
 import org.openbravo.idl.proc.Value;
 import org.openbravo.module.idljava.proc.IdlServiceJava;
 import com.fugoconsulting.xyzz.module.template.XYZZFrequency;
/**
 *
 * @author Pandeeswari
 */
 public class ImportFrequency extends IdlServiceJava {
private static Logger log=Logger.getLogger(ImportFrequency.class);
 DateFormat df = new SimpleDateFormat("dd-MM-yyyy");
@Override
 public String getEntityName() {
 return "Simple Frequency";
 }
@Override
 public Parameter[] getParameters() {
 return new Parameter[] {
 new Parameter("Organization", Parameter.STRING),
 new Parameter("SearchKey", Parameter.STRING),
 new Parameter("Name", Parameter.STRING),
 new Parameter("Description", Parameter.STRING),
 new Parameter("Factor", Parameter.STRING),
 new Parameter("Date", Parameter.STRING) };
 }
@Override
 protected Object[] validateProcess(Validator validator, String... values) throws Exception {
 validator.checkOrganization(values[0]);
 validator.checkNotNull(validator.checkString(values[1], 40), "SearchKey");
 validator.checkNotNull(validator.checkString(values[2], 60), "Name");
 validator.checkString(values[3], 255);
 validator.checkBigDecimal(values[4]);
 validator.checkDate(values[5]);
 return values;
 }
@Override
 public BaseOBObject internalProcess(Object... values) throws Exception {
return createFrequency((String) values[0], (String) values[1], (String) values[2],
 (String) values[3], (String) values[4], (String) values[5]);
 }
public BaseOBObject createFrequency(final String Organization, final String searchkey,
 final String name, final String description, final String factor,
 final String aDate)
 throws Exception {
// Frequency
 XYZZFrequency frequencyExist = findDALInstance(false, XYZZFrequency.class, new Value("searchKey", searchkey));
 if (frequencyExist != null) {
 throw new OBException(Utility.messageBD(conn, "XYZZ_FREQ_EXISTS", vars.getLanguage())
 + searchkey);
 }
 XYZZFrequency frequency = OBProvider.getInstance().get(XYZZFrequency.class);
try {
 frequency.setActive(true);
 frequency.setOrganization(rowOrganization);
 frequency.setSearchKey(searchkey);
 frequency.setName(name);
 frequency.setDescription(description);
 frequency.setFactor(new BigDecimal(factor));
 // Date date = df.parse(aDate);
 Date  date = new Date();
 frequency.setDate(date);
OBDal.getInstance().save(frequency);
 OBDal.getInstance().flush();
 } catch (Exception e) {
 e.printStackTrace();
 }
// End process
 OBDal.getInstance().commitAndClose();
return frequency;
 }
 }

I have created the Java File inside modules/mymodule/erpCommon/ad_process. You can place it where ever you want but just be careful to provide the proper Java package name.
Inside the getParameters() method, we provide the columns in the same order as it is in the input file. But the parameter names used in the method need not be the same.
The createFrequency() just inserts the value into the table using OBProvider.  The internalProcess(Object… values) Method which is inherited from IdlServiceJava class is used to call the appropriate method with appropriate parameters.
2. Register the file in entity default value
Register the Entity in Master Data Management -> Initial Data Load  -> Setup  -> Entity Default Value
Make Special note on the class name while adding the entity default value.
3. Import the data using import window
  • Go to Master Data Management -> Initial Data Load -> Process -> Import
  • Choose the input file
  • Choose the entity as Frequency
  • Give Validate
  • Once the input values are validated, the data can be loaded into the actual table by giving process.
  • If there occurs any problem with the input data, it will be logged in the boxes provided in the import screen.
Note: I thank my Colleague Pandi for helping me a lot in this regard.



Apr 26, 2011

New "Title" type nodes in Balance & PL reports

by David Alsasua
I would like to share with you a little, but useful enhancement, available starting from Openbravo MP28, that can be interesting to anybody configuring a chart of accounting, either as part of developing a localization or simply to adapt it to the needs of your company.
A new check-box is available in the Element Value tab (at Financial Management || Accounting || Setup || Account Tree || Element) named "Title Node":
This allows to print nodes in the Balance Sheet & PL report (at Financial Management || Accounting || Analysis Tools) with no amount, just as information or title of a report section, but located inside the report, as one node, with it's corresponding font size and style. This node will always be displayed, regardless of the value of the "Show only accounts with value" flag. For example, let's have a look to the following report:
where Total Expenses and Total Revenues nodes are calculated through operands, as a sum of the two nodes above them.
In this case, nodes 1.1 and 1.2, if displayed, will show duplicated amounts, as shown in this example:
As you can see, amounts are duplicated in the 1.1 and 1.2 nodes. These nodes must be shown, as are part of the structure of the report, but the amount obtained is not useful at all, so we should flag them as "Title Node". Let's see, then, the result:
For further information about how to configure this report, you can have a look at the configuration manual, or the Balance Sheet articles in our wiki.



Apr 23, 2011

Openbravo ERP – Zoho integration module

by Asier Zabaleta

Today im going to show you a simple module that will integrate Openbravo ERP with Zoho reports. The aim is to set up a background process sending data from the ERP to Zoho. Then, after creating custom reports on Zoho, publish them in your Openbravo ERP workspace so that relevant data for your company is always on hand.

Pre-requisites:
  • Zoho user account (free)
  • Zoho integration module for Openbravo ERP 3.0

Setting up the data transfer

First of all you need to have a new database in Zoho reports.
Then find the Zoho API key for your account. (Mandatory for sending data to your zoho account).

Now lets configure the process in Openbravo ERP. Create a Zoho integration header with the folowing information:
  • Zoho database (the one you created in the previous step)
  • Zoho API key
  • Zoho username
  • Zoho password
Then, configure an HQL for sending data to our Zoho database.
  • Import type: Choose between "Delete all and import data", "Append" or "Update".
  • Zoho Table (this process will create this table in Zoho Reports)
  • HQL query. (In this example I created a simple query for "Sales by Organization"

And last, schedule the process for sending this data to Zoho. In this case, I have configured this process to be run every 1 minute. Then hit "Schedule Process".

From now on, this process will create a new table in your Zoho Reports account, with the data of your ERP.


Report Creation

Time to create a report in Zoho reports with this data.


When done, save the chart and click on Publish and "Embed in Website/Blog".

Copy the HTML snippet and return back to Openbravo ERP to add a widget with this HTML code. Create an "User defined HTML widget".

Then just paste the HTML code from Zoho Reports:

And... Voilá !

Meaningful information for you company updated in real time in your Openbravo ERP workspace. And the best: No need for development skills to do it !

This article shows the power of how different separate parts of Openbravo technology can be combined to create a great solution.
  • Openbravo widgets
  • Openbravo Process Scheduler
  • Openbravo - Hibernate integration
And this is just an example of why web solutions are so powerfull these days. Their ease of integration with other tools make them a must !!

Any doubts or inquiries, I would be glad to answer them :)




Apr 22, 2011

Announcing Openbravo 3.0 RC6

by Paolo Juvara
I am pleased to announce the immediate availability of Openbravo 3.0 RC6, the fifth release candidate in the Openbravo 3 series.

Openbravo 3.0 RC6 is primarily a stabilization release, including over 130 fixes for issues reported by early adopters of previous release candidates.


Besides stabilization, Openbravo 3.0 RC6 also delivers some further productivity improvements that make the usage of the ERP easier and more agile:
  • Redesigned Alert window: alerts are exceptions in your business processes (for examples, overdue invoices or late orders) that your Openbravo system automatically detects and prompts you to manage. With the new alert window, investigating the cause of the anomaly, correcting it or dismissing it is a breeze.
  • Notes: notes is a new facility available on every document in the system that allows you to add textual annotations to your transactions. You can use this functionality to store unstructured information in your ERP. For instance, for example you can add a note to an overdue invoice to document the content of the conversation with your customers in which they promised to send a payment by next week; you can also use it to store a reminder that when you send a delivery truck to a particular customer, they need to call ahead of time so that the delivery gate can be open when the truck arrives.
Openbravo 3.0 RC6 is intended for production usage by early adopters and it is a fully supported release available in all editions, Community, Basic and Professional Edition.

If you are a new user interested in learning about Openbravo and evaluating the product, you should use Openbravo 3.0 RC6.
If you are an existing community member interested in staying up to speed with the latest evolutions of Openbravo, you should download and install Openbravo 3.0 RC6.

If you are interested in deploying Openbravo for production usage in a new project, you should also consider Openbravo 3.0 RC6. Early adopters interested in deploying Openbravo 3.0 RC5 in production are recommended to thoroughly test the processes relevant to their business before deploying them in production.

If you are already in production on an earlier version of Openbravo 3, we advise you to update your system to RC6 at your earliest convenience. If you are in production on Openbravo 2.50 or earlier, we advise you to wait for general availability before scheduling an upgrade.

If you want to learn more about Openbravo 3.0 RC6, please review the release notes for a full description of the release, download instructions or Amazon EC2 AMI codes. If you are pressed for time and have only a few minutes to learn about the product, you can take it for a spin in our demo environment.

As always, you are encouraged to tell us what you think, by posting a comment on this post, raising an issue in issues.openbravo.comor discussing it in the Early Releases Discussion forum.



Apr 14, 2011

How to create new import process with Initial Data Load

by Adrián Romero
Initial Data Load is a commercial module available for Openbravo ERP Professional Edition subscribers to import data that provides out of the box several import process oriented to set up all the data needed to start working with Openbravo ERP. After importing data with the provided processes, users will be able to genereate the initial balance sheet and to enter new transaction documents like orders, shipments and invoices.


This makes Initial Data Load a great tool focused to make shorter and cheaper the implementation process of Openbravo ERP but also Initial Data Load is extensible. You can use all the elements and tools provided, like the user interface, default values management, utilities, etc... to modify the existing processes to be adapted to your business requirements and to create new ones to import custom data. This way if you want to create a new process to import data you only need to focus in the logic because all the infrastructure provided by Initial Data Load will be reused.

To help with the task of creating new data import processes for Initial Data Load it is helpful the module Initial Data Load extension for Java. With this new module you will be able to develop a new data import process with a single java class and few lines of code. In this guide I will explain step by step the process of creating and deploying a new data import process using the java class sample included in the Initial Data Load extension for Java. After you read this visual guide you will be able to write, install and execute new processes quickly and reduce a lot the time needed to implement a fully working Openbravo ERP following your business requirements.

Step 1. Installation of the required modules

Log in as System Administrator and activate your instance in General Setup >> Application >> Instance Activation . To activate your instance you need first to adquire an Openbravo ERP Professional Subscription and use the System Key Openbravo will send to you.

After you have your instance activated, go to General Setup >> Application >> Module Management and install the modules Initial Data Load and Initial Data Load Extension for Java.


Step 2. Install the dataset.

The dataset provided by the Initial Data Load module contains the definition of the provided import processes and the default values for each process.

Login as your Client Administrator and go to General Setup >> Enterprise >> Enterprise Module Management, select Initial Data Load and press OK.


Step 3. Configure a new process.

The module Initial Data Load for Java provides a sample java class that implements an import process to import products. Now we are going to configure this class to invoke it from the Initial Data Load process window.

Go to Master Data Management >> Initial Data Load >> Setup >> Entity Default Values. Create a new record and fill in the field values. Pay attention to the field Class Name. The value must be org.openbravo.module.idljava.proc.SampleProductsProcess that is the name of the java class that implements the sample products import process.

If you cannot add new records, it is because there is a know issue already fixed in the Initial Data Load that prevents you to create new records. For more information about this, go to the issue report 16787.


Step 4. Execute the new process

Now we have everything we need to execute the new configured process that imports products. Go to Master Data Management >> Initial Data Load >> Process Import. Select the new configured process, in our example Custom Products. You can use this products sample CSV file to test the execution of the process. Press Validate or Process. Validate only checks that the data to import is valid but does not actually import the data. Process checks that the data is valid and import the data.

This is the result after pressing Process.


And one of the products imported:


Quick review the java class that implements this new process

The sample import process used in this post is SampleProductsProcess and is included in the module Initial Data Load for Java and you can use it as a foundation for the new processes you want to create. Here I will explain the main parts of this java class.

All classes that use Initial Data Load for Java to implement a new import process must extend the java class IdlServiceJava.

public class SampleProductsProcess extends IdlServiceJava {
...

Implemeting this class you must override the following methods: getEntityName() that returns the name of the process:

@Override
public String getEntityName() {
return "Sample Products";
}


getParameters(), that returns an array with the definition of the fields that will be used in this process. Each parameter basically consist in a field name and a data type:

@Override
public Parameter[] getParameters() {
return new Parameter[] {
new Parameter("Organization", Parameter.STRING),
new Parameter("SearchKey", Parameter.STRING),
new Parameter("Name", Parameter.STRING),
...

validateProcess() that validates the integrity of each record in the CSV file. For this task Initial Data Load provides the utility class Validator that has several test methods to check the data integrity:

@Override
protected Object[] validateProcess(Validator validator, String... values) throws Exception {
validator.checkOrganization(values[0]);
validator.checkNotNull(validator.checkString(values[1], 40), "SearchKey");
validator.checkNotNull(validator.checkString(values[2], 60), "Name");
...

And internalProcess() that actually imports the data. The recommended way to create Openbravo business objects and store it in the database is the Openbravo Data Access Layer (DAL) that provides an interface to all the Openbravo Business Objects and logic.

@Override
public BaseOBObject internalProcess(Object... values) throws Exception {
...

If you want an example of a module using Initial Data Load for Java, have a look at the project Initial Data Load extension for invoices. A module that implements a new data import process that allows to import invoices using Initial Data Load.



Apr 12, 2011

Database Development Perspective in Eclipse for Openbravo,Postgres

by Shankar Balachandran
Eclipse IDE is a great tool for Development and specially for development for an ERP like Openbravo. Also Eclipse Provides many plug ins that could make the development even easier. There are many perspectives provided in Eclipse. (Refer Screen shot below)
Lets see about the Database Development Perspective in this Blog. Database Development Perspective allows us to connect to database directly, export data as files, import data, query, etc...
To connect your Openbravo postgresql database, these are the steps to be performed.
1. Choose Database Development from the available list of perspectives.

2. Create a new Connection and connect the driver to database. Refer the following screen shots.


3. In the Driver definition, choose your host and database name, the database field can be anything (column1), it does not matter. Its just the name that will show in Eclipse.
4. Once this is done, your eclipse will be as below.
Under Schemas, you will have public that will have the tables and functions.
Now you are connected to your database and you can query, or use the other options as I have shown in the screen shot below. 

Happy Working..:)



Apr 6, 2011

Notes: a new feature for Openbravo 3RC6

by Asier Lostalé

Notes is a new feature that has just been added to Openbravo and will be released within the next Openbravo 3RC6 which will be soon available.

This feature adds a new section to all forms that allows to insert comments for any record in a really simple way.

Notes has been contributed to Openbravo by Valery Lezhebokov, an active community member.

Once again, thank you Valery!


Filed under: Openbravo Tagged: Contributions, functionality, Openbravo 3