Wednesday, August 7, 2013

Improvements in Attachment model in Openbravo

Attachments are one of the breezy UI aspects of Openbravo, where you can attach any number of attachments to any record in the application. The beauty of the feature lies in the fact that you can restrict the access to the attachments for a specific users/roles. An use case is provided here. From 3.0MP26 there are some improvements in the way Attachments are implemented. 

Change in architecture

Before 3.0MP26, the attachments were stored in the attachments directory (the attach.path property in Openbravo.properties). They were stored in this folder structure
  • AttachDirectory
    • tableId-recordId
      • Attachment.
But in few file systems like ext3 where there is a limit of 32k subfolders, this would exceed the maximum number of folders allowed.
To overcome this, the attachment model has been updated to save the attachment from 3.0MP26. For eg, for table Id "259", recordId "0F3A10E019754BACA5844387FB37B0D5", the file directory returned is "259/0F3/A10/E01/975/4BA/CA5/844/387/FB3/7B0/D5". i.e,
--> AttachDirectory
---> 259
----> 0F3
-----> A10
------> E01
-------> 975
--------> 4BA
---------> CA5
----------> 844
-----------> 387
------------> FB3
-------------> 7B0
--------------> D5
---------------> Attachment

Note that the attachments can be still be stored using the previous model by enabling the preference 'SaveAttachmentsOldWay' to 'Y'. For more information on using preferences refer here.


API's for Attachments Management:


Before these improvements, attachments were fetched using the standard folder name of tableId-recordId. Now API's have been introduced to fetch the attachments and also to get the directory where attachment have to be stored in the improved model based on the preference 'Save Attachments Old Way'.



API for fetching existing attachments:

The attachment can be fetched through an API method in TabAttachments. The method TabAttachments.getAttachmentDirectory can be used to fetch a particular attachment. The arguments to be passed are:
  • UUID of the ad_table
  • UUID of the record
  • fileName
It returns the path of the attachment relative to the attachment directory. The attachment directory can be fetched from Openbravo properties in java code using OBPropertiesProvider. Here is a blog on how it can be used. For eg., to fetch an attachment test.txt of recordId 0F3A10E019754BACA5844387FB37B0D5, tableId 259, the method can be used as follows:
String attachmentDirectory = TabAttachments.getAttachmentDirectory("259","0F3A10E019754BACA5844387FB37B0D5","test.txt");

API to fetch directory to save new attachments

When saving new attachments, the method TabAttachments.getAttachmentDirectoryForNewAttachments can be used to fetch the directory in which the attachment has to be stored. The arguments to be passed are, tableId and recordId . The value returned is the directory to save the record.Note that the directory returned is relative from the attachment directory of Openbravo.
TabAttachments.getAttachmentDirectoryForNewAttachments ("259","0F3A10E019754BACA5844387FB37B0D5");


Migrating existing attachments to the improved model


Existing attachments can be migrated based on the latest model using an ant task. The task can be executed using the following command,

ant migrate.attachments 

the customer instance does not have any extension that is using API to retrieve attachments, no change for them is required, no need to migrate attachments. New attachments will be saved and retrieved using new approach, old - retrieved old approach.

If there is an extension that uses the old API then two options are possible
1. Switch on the mode to save attachments old way and that is it (short-term solution).
2. Change the extension to use new API and migrate attachments (recommended for the mid-term, long-term).  Contact us through our forum or through our social network channels https://twitter.com/Openbravohttps://www.facebook.com/OpenbravoSLU  for any doubts. 

Thursday, June 20, 2013

Managing coworking spaces using "Openbravo Coworking"


Managing Coworking Spaces? 
Here is why you need "Openbravo Coworking".


The major boon and may be the only boon in the receding economic crisis is the emergence of strong startup hubs or coworking communities. Now coworking just does not mean sharing spaces. It is a lot more than that. It is an effective community where people are ready to discuss openly about the clients and help each other in resolving issues and building contacts and getting projects for each other. This in turn forms a network of highly skilled people sharing a common work environment which serves as an incubator for awesome products. If you are wondering whether coworking is needed, you can head to the discussions here.


Working in a coworking environment is fun for most companies, while managing coworking spaces can be quite a task. Right from managing member leads to finalizing spaces, allocation of desks, meeting halls, invoicing them properly and maintaining contracts, etc. Selecting appropriate members itself would prove to be a tough task. There are few general tips provided here.


But what are the things as a coworking space owner do you need to do?
1. The front office team can manage member leads with excel sheets.
2 The operations team can maintain desks and halls through any solution like this one. Even the members can actively participate.
3. The finance team can invoice the members with your accounting software which you used to file for taxing purposes.
4. The legal team then have to maintain the contracts and update them once in awhile and make sure to pass on the information to the other teams so that it is updated properly in their solutions.

Wait. Are you already tired? This is just the tip of the iceberg. Right from amenities like wifi, stationery items like boards, markers to the coffee mugs everything needs to be accounted and everything needs to be maintained. This is why you need a centralized solution that all your teams could use so that you can be peaceful and concentrate on improving the quality of your coworking space. Openbravo, has come up with one such solution, “Openbravo for Coworking. Openbravo, is the leading provider of browser based open source business applications for the cloud used by over 6500 organizations in 60 countries.

Designed in collaboration with industrial experts like RocketSpace and The Hub, the coworking vertical of Openbravo transforms your entire business into a simple, intuitive browser based application that can be used both by your employees as well as your members to quickly check availability of a meeting room, book a reservation for it, or check the status of their outstanding balances. The advantages of using Openbravo as a platform to manage your coworking space is huge. But let me just present a few here.
1. Multi Tenant architecture that allows you to securely run the same application for multiple clients without any concern about the security of the data.
2. State of the art technology that allows any user to access the application securely from their browsers without the need for any other installations.
3. Fully blown SCM solution including finance, sales, procurement, that covers you with generic business needs in addition to maintaining the coworking areas.
3. Openbravo can support multiple localizations in a single instances, thereby if you are running your coworking spaces in 4 different continents with different taxing rules and invoicing models, Openbravo has you covered.
4. With a modular architecture and a open source platform there are many modules which are provided by Openbravo and its partners which can be viewed here. If you are not able to select from the list of available modules, developing a module in Openbravo is really simple and can be completed in a matter of about couple of weeks.
5. Easily integrated with other solutions like SugarCRM, Magento, Amazon etc.
6. Member portals, where members can book meeting rooms, etc.

Well one more differentiating factor is that, it is completely cloud based which means you need not spend any cost on deployment and maintenance of the application. So in summary, these are the advantages of using “Openbravo Coworking” as your coworking solution:
1. Be ahead of your competitors : Thanks to a very productive and customizable interface resulting in a superior member experience.Improve tenancy and resource utilization
(e.g. desks, offices, meeting rooms) with multi-space analysis capabilities, and easy assignment capabilities.
2. Increase revenues : With performance analysis of spaces and resources combined with promotion management and with multi location (e.g. send someone to another coworking space of the same Group with availability).
3. Optimize income per member : With service optimization to every member thanks to the member portal that allows members to make space and resource reservations themselves, lowering the threshold to usage.
4. Timely invoicing and collections: With integrated invoicing and payment, keeping member contracts updated at all times and allowing for automatic, batch-based or one-by-one invoicing cycles, as it suits you best.
5. Control financial performance: Across individual spaces / locations / resource categories / product categories.
6. Decrease administrative costs: With member self-management and a unique central integrated system that avoids multiple systems to be maintained in parallel.

Pricing is one area I am sure you will be interested on. Openbravo Coworking is strategically priced, keeping in mind that coworking hubs are present all across the globe. You can view the pricing models here. Also note that this pricing does not affect the locations your coworking spaces are present. A single license is enough for all your locations.

I think I will wrap it up here.In case you have any queries, you can directly contact us here. Here is a nice video describing the solution. You can access a full demo of the coworking solution here.

Sunday, January 27, 2013

Enable/Disable options in Openbravo using Preferences

In Openbravo ERP, preferences are a cool and effective way to manage restrictions and apply certain additional actions at various levels like Client, Organization, Role and even at the window level. For more information on using preferences, refer http://wiki.openbravo.com/wiki/Preference

One such preference was enabling/disabling toolbar options like  Delete, Attach, Export. From Openbravo 3.0 MP17 you can enable or disable these options for a particular window or a particular user and even for a particular role. Lets see few scenarios where this could come handy.

Note that all these options are enabled by default and using preferences you will only be able to disable them.

Usecase 1 : Restrict Deletion of Records
John is a new intern and maintaining User Information. Though he should be allowed access to 'user' information window, he should not be allowed to delete Users. This can be done by creating a preference as in the screenshot. Once this setting is saved, John will not be able to delete records from the User Window.


Usecase 2 :  Restrict export data
John (again) has also access to the General ledger window. But since this is a critical data, you do not want him to be able to Export this information. Usually the export is done through the Export as Spreadsheet option provided at each window. To disable this you need to create a preference like the below screenshot.


Usecase 3: Restrict attachments option
David handles the goods receipt section. As soon as he receives a shipment, he uploads the scanned copy of the receipt to the Goods Receipt record. But you want all users with the role 'Sales' to be able to view the Goods Receipt window, but not be able to view the attachments. You can achieve this by creating a preference as follows



Hope these cases give a clear picture of the advantages of using these preferences.



Monday, January 7, 2013

Tips to speed up Openbravo Development

Openbravo as framework is as powerful as Openbravo as an ERP. Development and Customization has been very much streamlined due to the MVC architecture and the modular approach. That is one reason there are so many modules/verticals available on top of Openbravo.

Here are few tips that helped me increase my productivity in Openbravo development. This is more like a compiled list from various articles that I used. Feel free to add more to it in the comments.

1. SQL Query Editor
A feature that is available for a long time, the SQL Query Editor available in System Administrator role can be used for quick selects across any table in Openbravo. This could save your time from switching back from your query tool to the Application. To open the query Editor, go to SQL Query in the System Adminstrator role.



2. HQL Query Editor
A more useful tool that is provided as a module by Openbravo is the HQL Query Tool. This query can be used to perform hql query across all the Entities present in Openbravo. One advanced feature is that you can select your desired Entity from a drop down and find all the attributes of the Entity. To install the same, login as System Administratior, go to Module Management Window and search for 'Openbravo HQL Query Tool'.



3. Auto Logon Manager
The most time consuming task for me while developing is to type the default username and password more than few hundred times per day (increases exponentially with my potential code blunders). A simple feature that would remove this hassle is to use the Authentication Manager in Openbravo. Just add the following lines under Authentication section in Openbravo.properties file in config folder (or anywhere in the file, better to put it in the right section) to login into the Application as Openbravo user without having to enter the user credentials.
authentication.class=org.openbravo.authentication.basic.AutologonAuthenticationManager
authentication.autologon.username=Openbravo
Source : http://planet.openbravo.com/?p=7012

4. Smartclient Development Module
The smartclient development module provides you with an uncompressed version of the SmartClient components, thereby assiting in deep debugging of the Client side smartclient code, and also can provides non-obfuscated code so that you can debug even the custom code. More on the this module here.
http://wiki.openbravo.com/wiki/Client_Side_Development_and_API#The_smartclient.dev_module.2C_smartclient_console_and_sources

5. Logging into multiple roles at the same time
More often than not we will be usually juggling between the client admin login and the System Administrator login. To save time from switching over one login to another, there are two ways.
1. Use incognito /private browsing mode. Using the incognito mode, one role opened in a session and another role opened in another session (separate windows).
2. A simpler way is to use Ip/domain name differentiation. For eg., if you are running Openbravo in your local instance then you can have two tabs opened, one with the URL http://locahost:8080/Openbravo and other with 127.0.0.1:8080/Openbravo and have two different roles in each tab.

6. Debugger in chrome developer tools
One technical tip while debugging client side code, if you are not sure what your code actually errors out, you can use the 'debugger;' keyword that will stop the execution of the script at that point. But just be careful to remove the keyword after debugging so that the Application does not do that for unintended circumstances.