Archive

Archive for the ‘Linux’ 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,

Advertisements

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.

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.

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!

openerp-server 5.0 and Python 2.7

Ubuntu Inside

Image by Kordite via Flickr

After upgrading Ubuntu to 11.04 I found the nasty surprise that openerpserver 5.0 could not create a new database because it threw the following error message:

ValueError: opcode JUMP_IF_FALSE_OR_POP not allowed (u’auto_picking and test_auto_picking()’)

After doing some quick research with Google, I found the following bug that is already fixed in openerp-server v6:

https://bugs.launchpad.net/openobject-server/+bug/673773

Since upgrading to openerp v6 at this time is not an option for me, I only needed to make a slight change to make openerp-server work with Python 2.6. I already had python 2.6 installed in my Ubuntu system, which I could check with the following command:

gustavo@gustavo-laptop:/usr/bin$ python2.6
Python 2.6.6 (r266:84292, Mar 25 2011, 19:36:32)
[GCC 4.5.2] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>>

Then I changed the openerp-server command at my /usr/local/bin directory. I only needed to change the

exec /usr/bin/python ./openerp-server.py $@

line to

exec /usr/bin/python2.6 ./openerp-server.py $@

And that is all I needed to do to get my system back to work

Cheers!

HR Attendance analysis with OpenERP

March 27, 2011 2 comments
KDE 4.0

Image via Wikipedia

My partner, Cristian Sebastian Rocha, has been working the past three months in the development of the hr_attendance_analysis module, which, as its name suggests, helps companies analyze their employees attendance.

This module allows you make calculations on the worked hours by employees. You can apply formulas and calculation rules in order to automate attendance calculation. It can also be integrated with other HR related modules, such as the clock_reader module.

This module also has a workflow for confirming the entered date on each document type, journal and payroll. The first document holds daily attendance information for the employee, whereas payroll holds payroll information on a monthly, bi-weekly or daily basis.

These are some screenshots for the module:

In this image you can see the main menu for accessing the HR module. You can also see the menu items for accessing the Payroll documents (selected) and Attendance Journals.

In this image you can see the document with the summary of employee hours (filtered by a date range). You can leave notes for each employee or for the document. It can have two states: draft and validated. We still have to develop the workflow for cancelling and re-setting the document.

In this screenshot we can see the entry for the employee Journal. Here you can see in detail the in and out time for a given date. You can also see the vacations or time off hours (such as late arrivals, early departures, sick days, etc.) To the left you can also see the result of the hours calculation.

This is a formula for summarizing the values stored in the journal, in order to be shown in the Payroll document.

This is a formula for calculating normal hours in a given  date for a given employee:

In this screenshot, you can see a rule. This rule assigns reasons for the actions of entering or leaving the plant. IN this case we can see how to calculate an early leave without a warning.

We still have things to do, but soon we will upload the module to LaunchPad. If you have any comments, or suggestions, they are more than welcome.

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!