Archive

Archive for the ‘Ubuntu’ 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.

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!

OERPEnv: an environment manager for OpenERP

My business partner Cristian developed last week an application for managing different independent development/production environments in OpenERP. The idea is the tools allows you develop new modules easily, test new ones and test different configurations. For those with experience in Drupal, OERPEnv is similar to the drush tool. These days this tool is under development, so we don’t recommend it for those without Linux experience.

Below is the repository link where you can download the tool:

https://code.launchpad.net/oerpenv

If you have any question, please feel free to ask.

Cheers!

Categories: Configuration, Python, Ubuntu

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!

Safety Stock and reorder points in OpenERP

Curves of the cycle service level & fill rate ...

Image via Wikipedia

Safety Stock is the level of stock maintained to mitigate the risk of stockouts. Do you have safety stock in OpenERP? It depends. If you are running a manufacturing operation, and you manufacture to stock or build to order while keeping raw material inventory on-hand, you are actually using safety stocks. Chances are, if you don’t have safety stock you will run risks of stockouts and customer service deterioration.

Do you have a module or something like that in OpenERP? Actually no. And there might be a reason for that. But we will not go into that, we will show how to manage safety stocks and reorder points in OpenERP.

What you do have in OpenERP is the possibility of defining Minimum Stock Rules in your products. You need to do so if you are planning on using the MRP module. Actually it is mandatory to have minimum stock rules for all the raw material that you need in order to manufacture products. And you need to have minimum stock rules for your work-in-progress components in place when you build to stock work-in-progress components, or products.

The Minimum Stock Rules form allows you to define two quantities for your product. First the minimum quantity. This is a number that when it is reached by the virtual inventory, OpenERP creates a procurement in order to increase the stock of the product up to the Maximum Quantity amount (which is the second quantity in the Minimum Stock Rule).

And if you think about it, since all you need is to calculate your minimum and maximum quantities for your product, you don’t need to calculate your safety stock since it is already taken care of by the minimum quantity.

Now, how do you calculate your minimum quantity? You can do it with the following formula in LibreOffice:

Minimum Quantity = NORMINV(Service Level, Average Demand During Lead Time, Standard Deviation of Demand During Lead Time)

It’s a simple formula that can be used in LibreOffice or PostgreSQL (you need to install pgnumerics though, not a big deal)

Service level is the % of orders that you are planning to fulfill. If you are planning on satisfying average demand, you need to set it to 50%. If you are planning on satisfying 95% of your orders, you need to set it at 95%.

Average and Standard Deviation of Demand during lead time are quite straight-forward parameters. In order to calculate them you need to take all your orders you took during a period of time, and then calculate its average and standard deviation.

The minimum quantity  is composed of two components, the safety inventory piece and the lead-time demand piece. Lead-time demand can be calculated as the average demand you have for that product, and the safety stock can  be calculated as

Safety Stock = Minimum Quantity – Lead Time Demand

At this moment we are developing a module that calculates Minimum Quantity, Safety Stock and Lead Time Demand. We will keep you posted on this.

Cheers,