Feb 24, 2012

Testing Backbone.js and Enyo

by Iván Perdomo

As you may know we are iterating over several JavaScript frameworks to find the most appropriate for the mobile version of Openbravo 3.

As Salvador mentioned in the Open Discussions forum, Backbone.js + Twitter’s Bootstrap is a valid combination for a mobile application.

Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface …

On the other hand, Enyo

Enyo is an open source object-oriented JavaScript framework emphasizing encapsulation and modularity. Enyo contains everything you need to create a fast, scalable mobile or web application:

Built from the ground-up for mobile first – Enyo powers webOS, and was designed from the beginning to be fast and work great on mobile devices …

How easy is to create a plain product list using Backbone.js or Enyo? I wanted to give it a try. With a few lines of code I was able to make a REST call to Openbravo’s REST JSON Webservices and render a list of products.

Backbone.js

var Product = Backbone.Model.extend({});

  var ProductList = Backbone.Collection.extend({
    model: Product,
    url: '../../org.openbravo.service.datasource/Product',
    parse: function (response, error) {
      if (response && response.response) {
        return response.response.data;
      }
    }
  });

  var Products = new ProductList;

  var ProductsView = Backbone.View.extend({
    el: '#products',
    
    tag: 'ul',
    
    tpl: "<% _.each(models, function(product) { %> <li><%= product.attributes._identifier %></li> <% }); %>",
    
    initialize: function () {
      Products.bind('all', this.render, this);
      Products.fetch();
    },

    render: function (event, collection, error) {
      $(this.el).html('<ul>' + _.template(this.tpl, collection) + '</ul>');
      return this;
    }    
  });

  var App = new ProductsView;

Enyo

enyo.kind({
  name: 'ProductList',
  kind: enyo.Control,  
  components: [
      {name: 'btn', content: 'Load Products', ontap: 'loadProducts', tag:'button'},
      {name: 'list', tag: 'ul'}
  ],  
  loadProducts: function() {
      new enyo.Ajax({
        url: '../../org.openbravo.service.datasource/Product'
      })
      .go()
      .response(this, 'processResponse');
  },
  processResponse: function(inSender, inResponse) {
    var data = (inResponse && inResponse.response && inResponse.response.data), i;
    if(!data) {
      return;
    }
    for(i = 0; i < data.length; i++) {
      this.$.list.addChild(new enyo.Control({
        tag: 'li',
        content: data[i]._identifier
      }));
    }
    this.$.list.render();
  }
});
var products = new ProductList().renderInto(document.body);

I have packaged this code examples as a module. You can install it by cloning the repository and running smartbuild:

openbravo$ cd modules
openbravo/modules$ hg clone https://bitbucket.org/iperdomo/com.wordpress.katratxo.mobile.sample1
openbravo/modules$ cd ..
openbravo$ ant smartbuild -Dlocal=no

Note: openbravo is the root of your Openbravo sources

This examples doesn’t handle authentication, so in order to test them, first login into Openbravo and then visit the urls:

  • /openbravo/web/com.wordpress.katratxo.mobile.sample1/backbone.html
  • /openbravo/web/com.wordpress.katratxo.mobile.sample1/enyo.html

Conclusion

You can see that the Openbravo REST Web Services, provides a powerful layer for building alternative user interfaces for Openbravo.

We’ll keep iterating over the list of available JavaScript frameworks for Openbravo Mobile. If you have experience with Mobile Web Development, share your experience in the Open Discussions thread.




Feb 17, 2012

Choosing a HTML5 framework for Openbravo Mobile

by Iván Perdomo

Openbravo 3 is a great product built on top of SmartClient library. SmartClient is a great framework that provides a set of UI components for building enterprise size, data driven applications, but it targets desktop browsers and is not well suited for mobile devices. You could make it work on a tablet device with some simplification of the UI you’re building, but when it comes to a smartphone, is way too heavy.

One of the key projects of Openbravo in 2012, is the support for mobile devices. In the last few weeks I’ve been doing some research on the available frameworks for mobile web development.

You can make a list of available HTML5 frameworks from developer community driven sites like Stack Overflow
or Hacker News:

We can complete the previous list with other libraries targeting mobile devices like:

Splitting the list in two groups

The list of available frameworks can be divided in two groups based on their approach to solve the problem:

  1. You need to generate HTML code and the library is just an abstraction on top of the DOM that helps you with the user interaction (gestures, tapping, etc)
  2. You rely and “talk” JavaScript then the framework takes care of generating the necessary HTML code for building the UI component, plus helping with the user interaction (capturing events, etc)

From our experience in building Openbravo 3, the latter approach is preferred. It’s easier to write something like isc.Window.create({width: 600, height: 400}); than building the tree structure of DIVs for building a window, apply CSS styles and then test in the different supported browsers.

I went through the list of available frameworks. For example, jQuery Mobile takes the first approach. You need to create HTML tags and annotate them with some attributes like data-role in a list.

On the other hand, with Sencha Touch you “talk JavaScript” and the library takes care of building the UI component. Unfortunately Sencha Touch is released under GPLv3 license and is not compatible with Openbravo Public License (OBPL), so Sencha Touch is not an option.

For the same licensing reason Kendo UI and DHTMLX Touch discarded too.

Other libraries

There are other interesting libraries like Bakbone.js or Ember.js.

Backbone.js “gives structure to web applications” and is usually used with jQuery or Zepto, and Ember.js (previously SproutCore 2.0) aims to eliminate “boilerplate and provides a standard application architecture”. A comparison between the two libraries can be found on Backbone and Ember

Other Approaches

There are other attempts to use Google Web Toolkit combined with PhoneGap to build mobile applications. You can check the Webcast made by O’Reilly Creating Mobile Apps with GWT and PhoneGap.

Conclusion

We haven’t decided yet which framework we’ll use, but we prefer to use a library that will help us eliminating the need of generating HTML code.

We are still iterating over the available choices, but probably we’ll make a decision in a few weeks.

If you have experience in mobile web development and want to give us a hint, we’ll love to hear from you. Drop us a line in our Open Discussion forum thread.




Feb 16, 2012

New Openbravo User Guide is available.

by Dmitry Mezentsev

Dear All,

We have been working to provide the Community with reliable go-to information about Openbravo 3 in a handy, searchable, “green” on-line format.  And now (drum roll) I am pleased to announce (another drum roll) it is finally here!

More than 200 web pages of the User Guide contain what you need to know about Openbravo whether you are a developer, a partner, a user, or if you are just plain curious.  It is the place to go to first whenever you have a question about Openbravo’s functionality. Please be sure we are not going to stop here. From this foundation our next goal is to fine-tune delivered content and also to provide new text for all of Openbravo’s Advanced Features, and to create How-To responses to common questions.  We will be updating the document continuously as Openbravo evolves and as questions and answers arise within the community.

This is an important milestone many have been anticipating.  So check it out.  Look for answers to anything that perplexes you.  And if you don’t get your problem answered there, add a question to the new User Guide Forum .  Your insights will help grow the User Guide into a more and more valuable resource for everyone, over time.

You are also invited to attend our User Guide Webinar on Wednesday, 23 February at 8:30AM PST (4:30 GMT).  In this session we will provide details about how to the get the most out of the Openbravo 3 User Guide, how to help us make it better, and we will answer your questions.

Finally, I would like to thank several key people: Patricia San Juan and Renate Nieuwkoop, Asier Lostale and Augusto Mauch. Thanks to each of you for your efforts and initiative in helping us realize this goal.

Stay tuned to the Openbravo Planet wave because more insights about Openbravo Documentation are coming.




Feb 13, 2012

The business impact of installing modules

by Asier Zabaleta

Hi all,

Recently there have been published some modules that bring to the company the possibility to save daily costs by automating the user tasks in Openbravo ERP.

The first example would be the Clone invoices module . This module not only serves the purpose of showing how easy it is to extend the Openbravo ERP toolbar to add an action-button, but also creates the ability for the user to duplicate an invoice in a "one-click action".

The simple action of cloning an Invoice document (either sales or purchase invoices), lets the user save up to 5 minutes in each similar document he needs to register. This means, that in a monthly basis (taking into account that around 40 recurring documents can be cloned), the user will save up to 4 hours. Regardless the number of users or documents in the ERP, the company will achieve a remarkable saving in costs by the simple use of this module.

On the other hand, another module was published to streamline the creation of GL journals in Openbravo ERP. Using the new technology called Pick & Execute, this module allows the user to quickly insert lines in a GL journal.


Streamlining the task of entering new GL journals is something that makes a lot of sense in order to save the amount of time the user spends in it. From the moment this module is installed, the user will be able to enter more GL journals in the same time, or, entering the same amount of journals, have spare time to do anothers tasks.

Its not easy to calculate how much time the company saves with this module, but what can be said is that the user will save at least 50% of the time entering GL journals from the moment he uses this module. The impact is really remarkable.

Do you have similar modules which reduce company costs by allowing the user to complete daily tasks in less time ? I would love to hear about them.



Feb 6, 2012

Openbravo documentation. Status update. Part II.

by Dmitry Mezentsev

Dear All,

As a follow up to the initial blog post from Ismael we would like to announce that Documentation project is moving forward and I would like to let you know that 4 other Openbravo Application areas are now available:
General Setup - Owner: Patricia.
Production Management - Owner: Renate.
MRP - Owner: Renate.
Warehouse Management - Owner: Dmitry

This is the first iteration of putting documentation content for these areas in place and there will be several stages to improve it, but from the documentation structure, documentation approach and main content point of view we consider it final.

Please review all what has been delivered so far and start sharing your feedback with us!
Your input is really valuable and will help all of us (documentation is a collaborative project because it is needed for all) to improve Openbravo documentation!!
Finally our goal is for documentation to answer any question you might have during Openbravo presale, implementation, usage phases. If someone cannot address some request with a help of documentation – get in touch with Documentation project team and let´s improve documentation together.

For your information our short term plan is to document the only one area which is pending - Financial Management.
This task is in progress, owner: Patricia and Dmitry.
It is planned to be documented and ready for review by February 15th, 2012

Thanks and regards,

Patricia and Dmitry.