Archive

Archive for the ‘Configuration’ Category

Securing your system

Quick post of a script worth using. If your openerpserver is running on a Linux server, this server should be secured. Linux is a more secure server than Windows, but still is vulnerable to attacks. If you are new to the security field in Linux, there is a tool you should try, Bastille Unix. If you are using an

Ubuntu distribution, you can install this tool with the following command:

# sudo apt-get install bastille

After running the command bastille, you will see a wizard like window interface which will guide you through the different steps of hardening your system. These steps involve setting file permissions, disabling FTP, Firewall, Printing, disabling unnecesary services and accounts. Not only this is a very good tutorial on Linux security, but also a tool for hardening your system.

Be aware that your security obligations do not end here, this is just a very good first step.

Cheers,

How to debug your OpenERP modules

Debugging your OpenERP modules is quite straightforward, as long as you know basic Python programming. Just insert the following line in your

English: Python logo Deutsch: Python Logo

Image via Wikipedia

module:

import pdb;pdb.set_trace()

Then restart your openerp-server with the —debug option

# openerp-server –debug

Then monitor your server console. You will see your server stop and show you a command line prompt where you will be able to debug your program.
You will find further information in the Python documentation website.

Calculating a product cost with OpenERP

Last week I had the opportunity to try a very useful module that, IMHO, should be included in OpenERP core. This module is product_extended and can be found in the extras repository, you can download it with the following command:

#  bzr branch lp:openobject-addons/extra-6.0

This module does many things, among them shows the product last order for a supplier and its date. But what is really interesting is that it calculates a product cost based on its Bill of Materiales. In order to do that, first you need to check the “Compute Standard Price” check box in the product form,

Then, you can either click on the “Compute Standard Price” button or check it in the product bill of materials (a product can have more than one bill of materials). In the latter, you can find the product information on the Bill of Materials form.

You can calculate the standard price by clicking on the “Compute Standard Price” wizard on the right of the BoM form. How is this cost calculated? This is the interesting part, it takes into account the product cost of each product, plus the hours and cycle costs of every workcenter that is involved in its routing. A very useful module.

It needs a minor change in order to make it work with OpenERP 6.1 but you should try it, I highly recommend it

Cheers!

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.

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!!!!

Deleted records in OpenERP

December 21, 2011 Leave a comment
The blue/white elephant logo of the PostgreSQL...

Image via Wikipedia

Sooner or later you will find yourself with pgAdmin (or any other query tool) querying the OpenERP database in order to pull statistical information. It happens, and it is a healthy sign of your OpenERP implementation.

Something you need to keep in mind is how OpenERP “deletes” its records. It does not physically remove them. It just marks them as deleted. And it does so with the active field in the table. This field, which happens to be a boolean field, if true indicates that the record is not deleted. Otherwise you should not take the record into account in your queries.

Cheers!

Time-outs and the openerp-web client

December 20, 2011 Leave a comment

Sometimes you need to change the time-out setting of your openerp-web client application. There might be many reasons for this, among them the need to submit long  processes or views that take minutes to retrieve the desired data. Doing this is no big deal with the GTK client, but gets tricky  when it comes to the web client since you get a time-out error message after two minutes of inactivity.

How do you solve this? It’s easy. In OpenERP v5 you need to locate the file tiny_sock.py. In that file, search for the file that reads:

self.sock.settimeout(120)

In my web client, that happens to be the line 49. Then you change the parameter of the settimeout function to the number of seconds you desire. Then restart your web client.

With OpenERP v6 is pretty much the same story, now you do not need to modify the source code. You only need to change the openerp-web.cfg configuration file. In that file, you will find the following entry in the OpenERP Server section:

openerp.server.timeout = 450

Then you have to restart your web client application.
That’s all you need to do in order to change your timeout settings in your OpenERP Web Application.

Cheers!