Archive

Posts Tagged ‘Launchpad’

Automated actions in OpenERP

December 28, 2011 Leave a comment

In OpenERP, as in any other ERP or system, you need to perform certain tasks regularly. Tasks such as performing a backup, calculating ABC categories, running the MRP planner, etc. How do you get this done in OpenERP? It’s quite easy and you don’t need your server administrator to get this done. Scheduling tasks in OpenERP is done via the Scheduled Actions in the Administration > Configuration > Scheduler menu.
Scheduled Actions view
In this section, you will be able to create new actions. So click on the New button in the view.

After clicking New you will see a form that allows you to enter information in two tabs, an Information tab and a Technical tab. In the first tab you will be able to enter the name of the action, whether it is active or not, and how regularly it is executed. In the technical tab, and you might need a programmer help for this, you have to enter the name of the object that will run the action; along with the function to schedule and its arguments. This is the tricky part of scheduling an action, since you need to get into the details of how the system works and you will need your programmer to dig into the object code. But it is worth it, once you understand how this works, you will be able to get many things accomplished.

Logging from your OpenERP module

December 27, 2011 Leave a comment

I always wondered how to, in the OpenERP web client, show those informational messages in the top of the web client. Messages such as ‘PO/00001 created’. They are very informational for users.

Well… reading a presentation on the differences between OpenERP v5 and v6 I found that one of the additions was the self.log function which, as its name implies, logs a message to the audit logs (which can be accessed at Administration/Audit/Logs) and the Administration Dashboard (which can be accessed at Administration/Reporting/Dashboard/Administration Dashboard).

The function has the following syntax:

self.log(cr, uid, st.id, _(‘Statement %s is confirmed, journal items are created.’) % (st_number,))

The function returns the id of the entry created in the res_log table (or res.log business object) and takes the message to log and the context as parameters

Cheers!

ABC Analysis in OpenERP

December 26, 2011 Leave a comment

ABC analysis is very well covered in this Wikipedia article. So no point of talking about it again here. Thing is, how do you implement it in OpenERP.

Polish OpenERP screenshot

Image via Wikipedia

Truth is, it is not a great deal. You only need to pull the sale order lines for the past six months (for example, could be a year as well or the period under analysis), then by product summarize its sales (not taking into account any discounts) and then divide the sales number by the total sales amount, in order to figure out the product ABC Category. If you are an experienced programmer or data analyst, you can do this in minutes. If not, does not take long to figure out how to query the OpenERP database.

Thing is, this information is not integrated into OpenERP yet (and it makes sense, since you do not need this information for the MRP application. It’s nice to have it, but it is not critical). So I created a module that regularly categorizes OpenERP products according to its sales. I have not finished it yet and I need to upload it to LaunchPad, but I think I will do it this week.

What does this module do? Allows you to create ABC categories (you can have as many as you want) where you define the category and its range. Then regularly (as an scheduler action) categorizes the products taking into account their sales lines. Then updates the product abc_category field (created previously by the module installer).

I still need to polish the module and add a couple of files, such as a XML file with initial information (specially for the scheduler and categories). As soon as I get it done, I will upload it to LaunchPad and publish it.

Cheers!!!!

Random thoughts on the OpenERP website

February 12, 2011 1 comment
drupal icon, svg version

Image via Wikipedia

Actually, it’s more how I would like it to be. I just would like to share some ideas on how to make the OpenERP website better. Don’t get me wrong, I am not complaining since so far I have found everything I needed there. But it could be better. So this is my humble way of proposing some improvements.  I would also like to clarify that most of my ideas come from the Drupal website, which I have used for over two years and I consider it pretty good in how it is used by the Drupal community (BTW, OpenERP website is running on Drupal, quite weird for a system that runs with Python. Anyway, I continue to live and learn).

A very nice addition will be a section in the homepage of  “companies running with OpenERP”, and it should list the companies using OpenERP by country. It is a huge selling point, and it helps customers pick up the phone and call them directly to learn about their experience with the system. Makes the selling effort easier. Stats would be a nice addition as well.

Something I would correct (and this is a very easy fix) is moving the comments to the bottom of the documentation pages. Specially the tutorials. Documentation pages are thought to be read as book pages, without any interruption to the reading flow. Comments interrupt that flow. I understand comments add value to the documentation, but they do not substitute it. And they are making it harder (at least for me) to read it. Actually, it stops my reading process! (and I read a lot).

And since we are talking about the documentation, one of these days someone needs to write a Developer Book. I mean, I would like to buy it at Amazon. Why do I say this? OpenERP nowadays already has a lot in its core (the modules list is impressive), but the list of third-party add-ons is incredible. And this list will grow. And it will continue growing if there are developers ready to develop modules for OpenERP. A good way of teaching them how to do that, is with a book. Drupal has its own example with the Pro Drupal Development book.

And last but not least, and this will be hard to implement but it is really worth it… expand the modules page to the third party add-ons page. It will be a nightmare to implement it but it is worth it. Again, just look at the modules page in Drupal. OK, there is LaunchPad, but it is not enough. There is a lot to do on the documentation side, and this effort has to come from the third party developers, we can’t expect OpenERP employees to document for us. But it will be nice to have a central page where you can find most of the third party modules, and have people try them. Also its statistics will be quite useful as well. It will help grow the community and foster the software adoption. And it will help find the modules as well. Yesterday it took me over ten minutes to find the report-openoffice module. Believe me, every time I need to download a module in Drupal I know where to find it. It does not happen with OpenERP.

Again, this is not a critic to the current website. I just think it can be improved and just wanted to share some ideas I have about it.

Cheers!

What to do when you get an error in OpenERP

January 30, 2011 2 comments
Cover of "American Splendor"

Cover of American Splendor

Well, this is a quick Sunday post. What to do when you get an error message when working with OpenERP. First thing to do is to read the message itself, it might give you information on what might be going wrong, such as no space left on the disk. Or insufficient permissions.

But sometimes you get a printout like this:

Operating System Locale : fr_CH.cp1252
Python Version : 2.5.2
OpenERP-Client Version : 5.0.11
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
File “/usr/lib/

python2.5/site-packages/openerp-server/netsvc.py”, line 247, in dispatch
result = LocalService(service_name)(method, *params)
File “/usr/lib/python2.5/site-packages/openerp-server/netsvc.py”, line 76, in __call__
return getattr(self, method)(*params)
File “/usr/lib/python2.5/site-packages/openerp-server/service/web_services.py”, line 633, in execute
return self._execute(db, uid, wiz_id, datas, action, context)
File “/usr/lib/python2.5/site-packages/openerp-server/service/web_services.py”, line 613, in _execute
return wiz.execute(db, uid, self.wiz_datas[wiz_id], action, context)
File “/usr/lib/python2.5/site-packages/openerp-server/wizard/__init__.py”, line 178, in execute
res = self.execute_cr(cr, uid, data, state, context)
File “/usr/lib/python2.5/site-packages/openerp-server/wizard/__init__.py”, line 73, in execute_cr
action_res = action(self, cr, uid, data, context)
File “/usr/lib/python2.5/site-packages/openerp-server/addons/sale/wizard/make_invoice_advance.py”, line 65, in _createInvoices
val = obj_lines.product_id_change(cr, uid, [], data[‘form’][‘product_id’],uom = False, partner_id = sale.partner_id.id, fposition_id=sale.fiscal_position.id)
TypeError: product_id_change() got an unexpected keyword argument ‘fposition_id’

And you can’t make anything out of this. So… what do you do in this situation? Well, you can jump into Google and search for the error message

TypeError: product_id_change() got an unexpected keyword argument ‘fposition_id’

The first entry in the results is a bug notification in Launchpad. Checking the bug you can see there is a patch for the problem and that the bug is fixed. So download the patch and apply it with the patch utility.

Just to finish this post, you should watch this wonderful movie, American Splendor. I don’t get tired of watching it.

Cheers!