Thursday, June 28, 2012

FIND CPU INFO ON UBUNTU SERVER

  • How to find the ubuntu CPU or system info through command line.?

        root@ubuntu:/home/sufyan#  cat /proc/cpuinfo


Tuesday, January 10, 2012

Linux Command


Basic Linux Commands


This section gives insight into the most important commands of your SuSE Linux system. Along with the individual commands, parameters are listed and, where appropriate, a typical sample application is introduced. To learn more about the various commands, it is usually possible to get additional information with the man program followed by the name of the command, for example, man ls.
In these manual pages, move up and down with PgUp and PgDn and move between the beginning and the end of a document with Home and End. End this viewing mode by pressing Q. Learn more about the mancommand itself with man.
There are many more commands than listed in this chapter. For information about other commands or more detailed information, we recommend the O'Reilly publication Linux in a Nutshell. In the following overview, the individual command elements are written in different typefaces.
  • The actual command is always printed as command. Without this, nothing can function.
  • Options without which the respective program cannot function are printed in italics.
  • Further details, like file names, which must be passed to a command for correct functioning, are written in the Courier font.
  • Specifications or parameters that are not required are placed in [brackets].
Adjust possible specifications to your needs. It makes no sense to write ls file(s), if no file named file(s) actually exists. You can usually combine several parameters, for example, by writing ls -la instead of ls -l -a.

File Administration


ls [option(s)] [file(s)]
If you run ls without any additional parameters, the program will list the contents of the current directory in short form.
-l
detailed list
-a
displays hidden files

cp [option(s)] sourcefile targetfile




Copies sourcefile to targetfile.

-i
Waits for confirmation, if necessary, before an existing targetfile is overwritten
-r
Copies recursively (includes subdirectories)

mv [option(s)] sourcefile targetfile




Copies sourcefile to targetfile then deletes the original sourcefile.

-b
Creates a backup copy of the sourcefile before moving
-i
Waits for confirmation, if necessary, before an existing targetfile is overwritten

rm [option(s)] file(s)




Removes the specified files from the file system. Directories are not removed by rm unless the option -r is used.

-r
Deletes any existing subdirectories
-i
Waits for confirmation before deleting each file.

ln [option(s)] sourcefile targetfile




Creates an internal link from the sourcefile to the targetfile, under a different name. Normally, such a link points directly to the sourcefile on one and the same file system. However, if ln is executed with the -s option, it creates a symbolic link that only points to the directory where the sourcefile is located, thus enabling linking across file systems.

-s
Creates a symbolic link

cd [options(s)] [directory]




Changes the current directory. cd without any parameters changes to the user's home directory.

mkdir [option(s)] directoryname




Creates a new directory.

rmdir [option(s)] directoryname




Deletes the specified directory, provided it is already empty.

chown [option(s)] username.group file(s)




Transfers the ownership of a file to the user with the specified user name.

-R
Changes files and directories in all subdirectories.

chgrp [option(s)] groupname file(s)




Transfers the group ownership of a given file to the group with the specified group name. The file owner can only change group ownership if a member of both the existing and the new group.

chmod [options] mode file(s)




Changes the access permissions.
The mode parameter has three parts: groupaccess, and access typegroup accepts the following characters:

u
user
g
group
o
others
For access, access is granted by the + symbol and denied by the - symbol.
The access type is controlled by the following options:

r
read
w
write
x
eXecute — executing files or changing to the directory.
s
Set uid bit — the application or program is started as if it were started by the owner of the file.

gzip [parameters] file(s)




This program compresses the contents of files, using complex mathematical algorithms. Files compressed in this way are given the extension .gz and need to be uncompressed before they can be used. To compress several files or even entire directories, use the tar command.

-d
decompresses the packed gzip files so they return to their original size and can be processed normally (like the command gunzip).

tar options archive file(s)




The tar puts one file or (usually) several files into an archive. Compression is optional.
tar is a quite complex command with a number of options available. The most frequently used options are:

-f
Writes the output to a file and not to the screen as is usually the case
-c
Creates a new tar archive
-r
Adds files to an existing archive
-t
Outputs the contents of an archive
-u
Adds files, but only if they are newer than the files already contained in the archive
-x
Unpacks files from an archive (extraction)
-z
Packs the resulting archive with gzip
-j
Compresses the resulting archive with bzip2
-v
Lists files processed
The archive files created by tar end with .tar. If the tar archive was also compressed using gzip, the ending is .tgz or .tar.gz. If it was compressed using bzip2.tar.bz2.
Application examples can be found in Section “Archives and Data Compression”.

locate pattern(s)




The locate command can find in which directory a specified file is located. If desired, use wild cards to specify file names. The program is very speedy, as it uses a database specifically created for the purpose (rather than searching through the entire file system). This very fact, however, also results in a major drawback: locate is unable to find any files created after the latest update of its database.
The database can be generated by root with updatedb.

updatedb [options(s)]




This command performs an update of the database used by locate. To include files in all existing directories, run the program as root. It also makes sense to place it in the background by appending an ampersand (&), so you can immediately continue working on the same command line (updatedb &).

find [option(s)]




The find command allows you to search for a file in a given directory. The first argument specifies the directory in which to start the search. The option -name must be followed by a search string, which may also include wild cards. Unlike locate, which uses a database, find scans the actual directory.

Commands to Access File Contents



cat [option(s)] file(s)
The cat command displays the contents of a file, printing the entire contents to the screen without interruption.
-n
Numbers the output on the left margin

less [option(s)] file(s)




This command can be used to browse the contents of the specified file. Scroll half a screen page up or down with PgUp and PgDn or a full screen page down with Space. Jump to the beginning or end of a file usingHome and End. Press Q to exit the program.

grep [option(s)] searchstring filenames




The grep command finds a specific searchstring in the specified file(s). If the search string is found, the command displays the line in which the searchstring was found along with the file name.

-i
Ignores case
-l
Only displays the names of the respective files, but not the text lines
-n
Additionally displays the numbers of the lines in which it found a hit
-l
Only lists the files in which searchstring does not occur

diff [option(s)] file1 file2




The diff command compares the contents of any two files. The output produced by the program lists all lines that do not match.
This is frequently used by programmers who need only send their program alterations and not the entire source code.

-q
Only reports whether the two given files differ

File Systems


mount [option(s)] [<device>] mountpoint
This command can be used to mount any data media, such as hard disks, CD-ROM drives, and other drives, to a directory of the Linux file system.
-r
mount read-only
-t filesystem
Specifies the file system. The most common are ext2 for Linux hard disks, msdos for MS-DOS media, vfat for the Windows file system, and iso9660 for CDs.

For hard disks not defined in the file /etc/fstab, the device type must also be specified. In this case, only root can mount. If the file system should also be mounted by other users, enter the option user in the appropriate line in the /etc/fstab file (separated by commas) and save this change. Further information is available in mount.

umount [option(s)] mountpoint




This command unmounts a mounted drive from the file system. To prevent data loss, run this command before taking a removable data medium from its drive. Normally, only root is allowed to run the commandsmount and umount. To enable other users to run these commands, edit the /etc/fstab file to specify the option user for the respective drive.

System Commands

System Information


df [option(s)] [directory]
The df (disk free) command, when used without any options, displays information about the total disk space, the disk space currently in use, and the free space on all the mounted drives. If a directory is specified, the information is limited to the drive on which that directory is located.
-H
shows the number of occupied blocks in gigabytes, megabytes, or kilobytes — in human-readable format
-t
Type of file system (ext2, nfs, etc.)

du [option(s)] [path]




This command, when executed without any parameters, shows the total disk space occupied by files and subdirectories in the current directory.

-a
Displays the size of each individual file
-h
Output in human-readable form
-s
Displays only the calculated total size

free [option(s)]




The command free displays information about RAM and swap space usage, showing the total and the used amount in both categories.

-b
Output in bytes
-k
Output in kilobytes
-m
Output in megabytes

date [option(s)]




This simple program displays the current system time. If run as root, it can also be used to change the system time. Details about the program are available in date.

Processes



top [options(s)]
top provides a quick overview of the currently running processes. Press H to access a page that briefly explains the main options to customize the program.
ps [option(s)] [process ID]
If run without any options, this command displays a table of all your own programs or processes — those you started. The options for this command are not preceded by hyphen.
aux
Displays a detailed list of all processes, independent of the owner.

kill [option(s)] process ID




Unfortunately, sometimes a program cannot be terminated in the normal way. However, in most cases, you should still be able to stop such a runaway program by executing the kill command, specifying the respective process ID (see top and ps).
kill sends a TERM signal that instructs the program to shut itself down. If this does not help, the following parameter can be used:

-9
Sends a KILL signal instead of a TERM signal, with which the process really is annihilated by the operating system. This brings the specific processes to an end in almost all cases.

killall [option(s)] processname




This command is similar to kill, but uses the process name (instead of the process ID) as an argument, causing all processes with that name to be killed.

Network


ping [option(s)] host name|IP address
The ping command is the standard tool for testing the basic functionality of TCP/IP networks. It sends a small data packet to the destination host, requesting an immediate reply. If this works, ping displays a message to that effect, which indicates that the network link is basically functioning.
-c
number Determines the total number of packages to send and ends after they have been dispatched. By default, there is no limitation set.
-f
flood ping: sends as many data packages as possible. A popular means, reserved to root, to test networks.
-i
value Specifies the interval between two data packages in seconds. Default: one second

nslookup




The Domain Name System resolves domain names to IP addresses. With this tool, send queries to information servers (DNS servers).

telnet [option(s)] host name or IP address

 

Open Port 25 on Linux machine for SMTP send-email feature

man ufw for policies
or
sudo ufw allow 25

Wednesday, October 12, 2011

Installing OpenERP 6 Server on Mac OS X 10.6 (Snow Leopard)

Installing OpenERP Server
Step 1: We're going to use MacPorts to install the dependencies required by OpenERP. The latest version at the time of this writing is 2.0.1 but any later version should work and install the same. Download the version of MacPorts for Snow Leopard and run the installer package to get started. NOTE: MacPorts requires the Xcode developer tools. They can be found on your Mac OS X 10.6 Install DVD or downloaded from the Apple Developer Connection website.

Step 2: Join the Apple Developer Connection (their FREE membership will suffice) and download/install the Java for Mac OS X 10.6 Developer Package which contains the Java header files required by some of the dependencies.

Step 3: Install PostgreSQL 9.0.4 using the EnterpriseDB bundle available here. During the installation it will ask you where you want certain files installed. I used the following settings for organizational reasons:

  • Installation Directory: /Library/PostgreSQL/9.0
  • Data Directory: /Library/Server/PostgreSQL/Data 
  • Server Port: 5432
Open /Applications/Utilities/Terminal.app and type in the following commands to add the PostgreSQL bin directory to the database user's PATH:

johndoe$ sudo -i
Password: *enter your user password here*
root# export PGHOME=/Library/PostgreSQL/9.0
root# echo 'export PATH=/Library/PostgreSQL/9.0/bin:$PATH' >> $PGHOME/.profile
root# exit
logout


Step 4: We need to create a database user account that OpenERP will use to connect to PostgreSQL. The following commands should be entered into Terminal.app to create the openerp database user:

johndoe$ sudo su - postgres
Password: *enter your user password here*
postgres$ createuser --createdb --no-createrole --pwprompt openerp
Enter password for new role: *enter the openerp database user's password*
Enter it again: *enter the openerp database user's password - again*
Shall the new role be a superuser? (y/n) n
Password: *enter the postgres user's password*
postgres$ exit
logout


Step 5: Type the following commands into Terminal.app to install the OpenERP Server dependencies:

johndoe$ sudo -i
Password: *enter your user password here*
root# port install python26
root# port select python python26
root# export PATH=/Library/PostgreSQL/9.0/bin:$PATH
root# port install py26-setuptools; easy_install setuptools
root# port install py26-psycopg2 +postgresql90; easy_install psycopg2
root# port install py26-reportlab; easy_install reportlab
root# port install py26-lxml; easy_install lxml
root# port install py26-tz; easy_install pytz
root# port install py26-yaml; easy_install PyYaml
root# port install py26-mako; easy_install mako
root# port install py26-dateutil; easy_install DateUtils
root# port install graphviz +python26 +no_x11
root# port install py26-parsing; easy_install pyparsing
root# port install py26-pil; easy_install pil


Step 6: In order to run OpenERP securely we need to create an unprivileged system user. The following command displays a list of current users on the system - the numbers on the right are their user ids. You need to chose a unique user id that is not in the list for the new OpenERP user (preferable the next id in the 500 sequence).

root# dscl . -list /Users UniqueID
root# export NEW_USER_ID=*the unique id you have chosen for the openerp user*


Now we can run the following commands to create the new unprivileged openerp user:

root# dscl . -create /Users/openerp
root# dscl . -create /Users/openerp UniqueID $NEW_USER_ID
root# dscl . -create /Users/openerp NFSHomeDirectory /var/empty
root# dscl . -create /Users/openerp UserShell /bin/sh
root# dscl . -create /Users/openerp PrimaryGroupID 1
root# dscl . -create /Users/openerp RealName "OpenERP User"
root# dscl . -create /Users/openerp Password "*"
root# exit
logout


Step 7: Now that all the dependencies have been satisfied, download the OpenERP 6.0.2 Server Sources and move openerp-server-6.0.2.tar.gz to your Desktop. Double-click the archive to decompress and extract its contents. You should now have a directory named openerp-server-6.0.2 in your ~/Desktop folder. To install OpenERP Server run the following commands in Terminal.app:

johndoe$ cd ~/Desktop/openerp-server-6.0.2
johndoe$ sudo python setup.py install


Step 8: Now that OpenERP Server has been installed we need to configure it to run automatically when the computer is turned on, but first we need to configure the /Library/Server directory to secure the files we will put there. The following also creates a Logs folder where OpenERP Server logs will be stored.

johndoe$ sudo -i
Password: *enter your user password here*
root# cd /Library/Server
root# chown root:admin ./; chmod 0775 ./
root# chown -R postgres:wheel ./PostgreSQL; chmod 0770 ./PostgreSQL
root# mkdir -p ./OpenERP/Configuration
root# cd ./OpenERP
root# touch ./Configuration/openerp-server.conf
root# mkdir ./Logs
root# chown -R openerp:wheel ./; chmod -R 0770 ./


Use the following command to create the openerp-server.conf file in the /Library/Server/OpenERP/Configuration directory:

root# pico -w ./Configuration/openerp-server.conf

You can then paste the following into the text editor that opens. Make sure you update the file to include the correct admin_passwd and db_password:

[options]
without_demo = True
; This is the password that allows database operations:
admin_passwd = ***enter your database admin password here***
upgrade = False
verbose = False
netrpc = True
; netrpc_interface =
; netrpc_port =
xmlrpc = True
; xmlrpc_interface =
xmlrpc_port = 8069
db_host = localhost
db_port = 5432
; Please uncomment the following line *after* you have created the
; database. It activates the auto module check on startup.
db_name = False
db_user = openerp
db_password = ***enter the openerp database user password here***
; Uncomment these for xml-rpc over SSL
; secure = True
; secure_cert_file = /etc/openerp/server.cert
; secure_pkey_file = /etc/openerp/server.key
root_path = /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/openerp-server
soap = False
translate_modules = ['all']
demo = {}
addons_path = None
reportgz = False
; Static http parameters
static_http_enable = False
static_http_document_root = /var/www/html
static_http_url_prefix = /


Use Ctrl-x to close the file and enter y when prompted whether or not to save it. Now for the startup script:

root# cd /Library/LaunchDaemons
root# pico -w com.openerp.openerpserver.plist


Again you can just copy and paste the following text into the editor. This time there are no substitution that need to be made:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>EnvironmentVariables</key>
<dict>
<key>PY_USE_XMLPLUS</key>
<string></string>
<key>PATH</key>
<string>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/X11R6/bin:/opt/local/bin:/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin</string>
</dict>
<key>UserName</key>
<string>openerp</string>
<key>Label</key>
<string>com.openerp.openerpserver</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/openerp-server</string>
<string>-c</string>
<string>/Library/Server/OpenERP/Configuration/openerp-server.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceDescription</key>
<string>OpenERP Server</string>
<key>StandardOutPath</key>
<string>/Library/Server/OpenERP/Logs/OpenERP-Server.out</string>
<key>StandardErrorPath</key>
<string>/Library/Server/OpenERP/Logs/OpenERP-Server.err</string>
</dict>
</plist>


Step 9: At this point OpenERP Server should be fully installed and configured. You can now run the following command to start the server - no restart necessary.

root# launchctl load ./com.openerp.openerpserver.plist
root# exit
logout

Saturday, September 24, 2011

Accounting in OpenERP6

Basic Accounting
In our normal accounting cycle we use some of accounting books like sale journal, purchase journal, bank book, expense journal, general journal etc.
Openerp supports 5 different journal types;
Sale: for sale and sale returns journals
Purchase: purchases and purchase return journals
Cash: Cash Book and bank Book
General: General Journal
Situation: Opening Balance journal
In coming few steps of configuration I will show how to create journals of type Sale Journal, Purchase Journal, Opening Balance, Bank Book.
To create new journal access Financial management Configuration Financial Accounting Financial Journals (click new button)
Sale Journal:
Journal Name: Sales Journal
Code: SAJ
Active: Select
Type: Sale
View: Journal View
Entry Sequence: Sale Journal

Sales Journal
Purchase Journal:
Journal Name: Purchase Journal
Code: PUJ
Active: Select
Type: Purchase
View: Journal View
Entry Sequence: Purchase Journal
Purchase Journal
Opening Balance Journal:
Journal Name: Opening Balance Journal
Code: OBJ
Active: Select
Type: Situation
View: Journal View
Entry Sequence: Account Journal
Opening Balance Journal
Bank Book:
Journal Name: Bank Book Acc 1216
Code: BNK
Active: Select
Type: Cash
View: Cash Journal View
Entry Sequence: Account Journal
Default Debit Account: 1-2 Bank Acc 1216 (Bank account from your chart of account)
Default Credit Account: 1-2 Bank Acc 1216 (Bank account from your chart of account)
Bank Book

Wednesday, September 21, 2011

Warehouse modules


Open ERP’s stock management is at once very simple, flexible and complete. It is based on the
concept of double entry that revolutionized accounting. The system can be described by Lavoisier’s
maxim “nothing lost, everything changed” or, better, “everything moved”. In OpenERP you do not
talk of disappearance, consumption or loss of products: instead you speak only of stock moves from
one place to another.
Just as in accounting, the OpenERP system manages counterparts to each of its main operations such as receipts
from suppliers, deliveries to customers, profit and loss from inventory, and consumption of raw materials. Stock
movements are always made from one location to another. To satisfy the need for a counterpart to each stock
movement, the software supports different types of stock location:
  • Physical stock locations,
  • Partner locations,
  • Virtual counterparts such as production and inventory.
Physical locations represent warehouses and their hierarchical structure. These are generally the locations that
are managed by traditional stock management systems.
Partner locations represent your customers’ and suppliers’ stocks. To reconcile them with your accounts, these
stores play the role of third-party accounts. Reception from a supplier can be shown by the movement of goods
from a partner location to a physical location in your own company. As you see, supplier locations usually show
negative stocks and customer locations usually show positive stocks.
Virtual counterparts for production are used in manufacturing operations. Manufacturing is characterized by the
consumption of raw materials and the production of finished products. Virtual locations are used for the
counterparts of these two operations.
Inventory locations are counterparts of the stock operations that represent your company’s profit and loss in terms
of your stocks.
The figure Location structure when OpenERP has just been installed shows the initial configuration of the
locations when the software is installed.

Location structure when OpenERP has just been installed
For this chapter you should start with a fresh database that includes demo data, with Warehouse Management and
its dependencies installed and no particular chart of accounts configured.
1.1  Understanding Double-Entry Stock Management
To illustrate this concept of stock management, see how stock moves are generated by the following operations:
Receiving products from a supplier,
Delivery to a customer,
Inventory operation for lost materials,
Manufacturing.
The structure of stock locations is shown by the figure Location structure when OpenERP has just been installed.
Stocks are assumed to be totally empty and no operation is in progress nor planned.
If you order ‘30 bicycles’ from a supplier, OpenERP will do the following operations after the receipt of the
products:
Stock Move Operation from Suppliers to Stock

If you deliver 2 bicycles to a European customer you will get the following transactions for the delivery:
Stock Move Operation from Stock to European Customers

When the two operations are complete, you will see the following stock in each location:
Resulting Stock Situation
So you can see that the sum of the stocks of a product in all the locations in OpenERP is always zero. In
accounting you would say that the sum of the debits is equal to the sum of the credits.
Partner locations (customers and suppliers) are not located under your company in the hierarchical structure, so
their contents are not considered as part of your own stock. So if you just look at the physical locations inside
your own company those two bicycles are no longer in your company. They are no longer in your own physical
stock, but it is still very useful to see them in your customer’s stock because that helps when you carry out
detailed stock management analysis.
You can make a comparison with accounting, where you will easily find an error because you can look for an
anomaly in an account or in the counterparts: if there is not enough in a bank account then that is probably
because someone hass forgotten to enter a customer’s invoice payment. You always know that the sum of debits
must equal the sum of the credits in both accounting and OpenERP’s stock management.
In accounting, all documents lead to accounting entries that form the basis of management accounting. If you
create invoices or code in statements of account, for example, the results of the operations are accounting entries
on accounts. And it is the same for stock management in OpenERP. All stock operations are carried out as simple
stock moves. Whether you pack items, or manufacture them, or carry out a stock inventory operation, stock
moves are carried out every time.
You have seen a fairly simple example of goods receipt and product delivery, but some operations are less
obvious – a stock inventory operation, for example. An inventory operation is carried out when you compare the
stock shown in software with real stock numbers counted in the stores.  In OpenERP, with its double-entry stock
management, you would use stock moves for this inventory operation. That helps you manage your stock
traceability. Suppose there are 26 bicycles in real stock but OpenERP shows 28 in the system. You then have to
reduce the number in OpenERP to 26. This reduction of 2 units is considered as a loss or destruction of products
and the correction is carried out as in the following operation:
Inventory Operation to Adjust Stock

The product stock under consideration then becomes:
Real and Counterpart Stocks when Operations are Completed
This example shows one of the great advantages of this approach in terms of performance analysis. After a few
months, you can just make a stock valuation of the location Virtual  Locations  >  Inventory  Loss to
give you the value of the company’s stock losses in the given period.
Now see how the following manufacturing operation is structured in OpenERP. To make a bicycle you need two
wheels and a frame. This means that there should be a reduction of two wheels and a frame from real stock and
the addition of a bicycle there. The consumption / production is formalized by moving products out of and into
physical stock. The stock operations for this are as follows:
Stock Situation Resulting from Manufacturing
So now you have got the outcome you need from the consumption of raw materials and the manufacturing of
finished products.
1.2  From Supplier to Customer
Now you will follow a practical example by adapting stock management operations. You will learn how to:
  • Define a new product
  • Set initial inventory
  • Receive products from a supplier
  • Deliver to a customer
  • Analyse the status of stock
1.2.1  Define a New Product
To start, define the following product:
Product Definition
Use the menu Warehouse → Product → Products, then click New to define a new product.
Definition of a new product
Three fields are important for stock management when you are configuring a new product:
Product Type,
Procurement Method,
Supply Method.
1.2.2  Product Types
The product type indicates whether the product is handled in stock management and if OpenERP manages its
procurement. The three distinct product types are:
  • Stockable Product: This product is used in stock management and its replenishment is more or less
    automated as defined by the rules established in the system. Examples: a bicycle, a computer or a central
    heating system.
  • Consumable: This product is handled in stock management, you can receive it, deliver it and produce it.
    However, its stock level is not managed by the system. OpenERP assumes that you have got sufficient
    levels in stock at all time, so it does not restock it automatically. Example: nails.
  • Service: It does not appear in the various stock operations. Example, a consulting service.
1.2.3  Procurement Methods – Make to Stock and Make to Order
The procurement method determines how the product will be replenished:
  • Make to Stock: your customers are supplied from available stock. You procure a set quantity of each
    product when its stock is too low (according to minimum stock rules). Example: a classic distributor.
  • Make to Order: when a customer order is confirmed, you then procure or manufacture the products for this
    order. A customer order ‘Make to Order’ will not modify stock in the medium term because you restock
    with the exact amount that was ordered. Example: computers from a large supplier assembled on demand.
You find a mix of these two modes used for the different final and intermediate products in most industries. The
procurement method shown on the product form is a default value for the order, enabling the salesperson to
choose the best mode for fulfilling a particular order by varying the sales order parameters as needed.
The figures Change in stock for a product managed as Make to Stock and Change in stock for a product managed
as Make to Order show the change of stock levels for one product managed Make to Order and another managed
Make to Stock. The two figures are taken from OpenERP’s Stock Level Forecast report, available from the
product form.

Change in stock for a product managed as Make to Stock

Change in stock for a product managed as Make to Order
1.2.4  Supply Methods
OpenERP supports two supply methods:
  • Produce: when the product is manufactured or the service is supplied from internal resources.
  • Buy: when the product is bought from a supplier.
These are just the default settings used by the system during automated replenishment. The same product can be
either manufactured internally or bought from a supplier.
These three fields (Supply Method, Procurement Method, Product Type) determine the system’s behaviour when
a product is required. The system will generate different documents depending on the configuration of these three
fields when satisfying an order, a price quotation to a supplier or a manufacturing order.
OpenERP manages both stockable products and services. A service bought from a supplier in Make to Order
mode, will generate a subcontract order from the supplier in question.
Figure Workflow for automatic procurement, depending on the configuration of the product illustrates different
cases for automatic procurement.

Workflow for automatic procurement, depending on the configuration of the product
The table below shows all possible cases for the figure Workflow for automatic procurement, depending on the
configuration of the product.
Consequences of Procurement Methods Make to Stock (MTS)
and Make To Order (MTO)
Consequences  of  Procurement  Methods
when using Services
You will learn more about the automated management processes for procurement further on in this chapter.
1.2.5  Units of Measure
OpenERP supports several units of measure. Quantities of the same product can be expressed in several units of
measure at once. For example you can buy grain by the tonne and resell it by kg. You just have to make sure that
all the units of measure used for a product are in the same units of measure category.
The table below shows some examples of units of measure and their category. The factor is used to convert from
one unit of measure to another as long as they are in the same category.
Example Units of Measure
Depending on the table above you have 1Kg = 1000g = 0.001 Tonnes. A product in the Weight category could
be expressed in Kg, Tonnes or Grammes. You cannot express it in hours or pieces.
Use the menu Warehouse → Configuration → Products → Units of Measure → Units of Measure to define a new
unit of measure.
In the definition of a Unit of Measure, you have a Rounding precision factor which shows how amounts are
rounded after the conversion. A value of 1 gives rounding to the level of one unit. 0.01 gives rounding to one
hundredth.
To activate the management options for double units of measure, assign the group Useability / Product UoS View
to your user.
In this case the same product can be expressed in two units of measure belonging to different categories. You can
then distinguish between the unit of stock management (the piece) and the unit of invoicing or sale (kg).
In the product form you can then set one unit of measure for sales and stock management, and one unit of
measure for purchases.
These units are given suggested titles. For each operation on a product you can use another unit of measure, as
long as it can be found in the same category as the two units already defined. If you use another unit of measure,
OpenERP automatically handles the conversion of prices and quantities.
So if you have 430 Kg of carrots at 5.30 EUR/Kg, OpenERP will automatically make the conversion if you want
to sell in tonnes – 0.43 tonnes at 5300 EUR / tonne. If you had set a rounding factor of 0.1 for the tonne unit of
measure then OpenERP will tell you that you have only 0.4 tonnes available.
1.3  Stocks
In the product form you can find the Stock by Location action that will give you the stock levels of the various
different products in any selected location. If you have not selected any location, OpenERP calculates stocks for
all of the physical locations. When you are in the Stock by Location view, click the Print button to print the
Location Content or the Location Inventory Overview reports.
In this respect, two important fields in the product form are:
  • Real Stock: Quantity physically present in your warehouse,
  • Virtual Stock: Calculated as follows: real stock – outgoing + incoming.
1.3.1  Lead Times and Locations
The tab Procurement & Locations contains information about different lead times and locations. Three lead time
figures are available:
Customer Lead Time: lead time promised to the customer, expressed in number of days between the order
and the delivery to the customer,
Manufacturing Lead Time: lead time, in days, between a production order and the end of production of the
finished product,
Warranty (months): length of time in months for the warranty of the delivered products.
Fields in the section Storage Localisation are given for information – they do not have any impact on the
management of stock.
Counter-Part Locations Properties are automatically proposed by the system but the different values can be
modified. You will find counterpart locations for:
Procurement,
Production,
Inventory.
A procurement location is a temporary location for stock moves that have not yet been finalized by the scheduler.
When the system does not yet know if procurement is to be done by a purchase or production, OpenERP uses the
counterpart location Procurement. In this location, you will find everything that has not yet been planned by the
system. The quantities of product in this location cancel each other out.
1.3.2  Initial Inventory
Once a product has been defined, use an initial inventory operation to put current quantities into the system by
location for the products in stock. Use the menu Warehouse → Inventory Control → Physical Inventories to do
your initial inventory.

Defining a new inventory operation
Give a name (for example Initial  Inventory or Lost  Product  XYZ ) and a date (proposed by
default) for each inventory operation.
You have three ways of doing an inventory.
  • Click the Import inventory action and select the location concerned. You can choose to include child
    locations and set the inventory to zero (especially useful to ensure the count is done correctly).
  • You can update the inventory from the Product form. Go to the Information tab, Stocks and click the
    Update button. On confirmation, OpenERP will create a Physical Inventory.
  • You can manually add inventory lines. You can then enter data about the quantities available for each
    product by location. Start by entering the location, for example Stock , and then select the product.
    OpenERP automatically completes the quantity available for that product in the location shown. You can
    then change that value to correct the value in stock.
Enter data for a single line in your inventory:
  • Location : Stock,
  • Product : PC1 Computers,
  • Quantity : 23 Units.
When your inventory operation is finished, you can confirm it using the Confirm Inventory button to the bottom
right of the form. OpenERP will then automatically create the stock moves to close the gaps, as mentioned at the
start of this chapter. You can verify the moves generated using the Posted Inventory tab of the inventory operation
form.
The correct levels of your product are now in your stock locations. A simple way of verifying this is to reopen
the product form to see the quantities available in stock.
1.3.3  Receipt of a Supplier Order by Purchase Order
Incoming Shipments forms are automatically prepared by OpenERP from the purchase management process.
You will find a list of all the awaited receipts in the menu Warehouse → Warehouse Management → Incoming
Shipments. Use the order number or the supplier name to find the right goods receipt form for confirmation of a
goods in. This approach enables you to control quantities received by referring to the quantities ordered.

List of items waiting
You can also do goods-in data entry manually if there is no order, using the same menu by clicking on New
button.
A new goods-in data entry form then opens. Enter the supplier data in the Address field and you can type in the
reference number from your supplier in the field Origin. You should then enter data about the products received
in the lines.
The source location is already completed by default because of your supplier selection. You should then give the
destination location where you will place the products. For example, enter Stock. At this stage you can set a lot
number for traceability (this function will be described later in this chapter, so leave this field empty for the
moment).
Once the form has been completed you can confirm the receipt of all the products at the same time using the
Process Now button. If you want to enter data for a goods receipt that you are still waiting for click the button
Process Later.

Form for entering goods received from a supplier order
The products then arrive in stock and should reflect the quantities shown on the product form.
In the Incoming Shipments form, the field Invoicing Control lets you influence the way you send invoices to
suppliers. If this is set to To  be  invoiced a supplier invoice will now be generated automatically in the draft
state, based on the goods received. Your accountant then has to confirm this pre-invoicing once the supplier’s
invoice is received. This enables you to verify that the invoiced quantities correspond to the quantities received.
1.3.4  Receipt of a Supplier Order by Product
From this version on, you can also handle receptions by product, even from List view. Go to Warehouse →
Products Moves → Receive Products.
Filters allow you to easily select receipts to be done, and so on. One way to quickly receive products is to Group
by Supplier and select To Do.
This is very useful functionality when your supplier sends the goods for several purchase orders at a time. You
can now just receive the products, regardless of the purchase order they come from.
The List view offers great flexibility and allows you to rapidly receive products by keeping full functionality! Of
course, you can handle both partial and complete receptions and you can add information about the production
lots and packs.
Of course, you can also accomplish this from Form view.
1.3.5  Customer Delivery
Everything about goods receipt can also be done manually for a customer delivery. But this time, use the
automated product delivery processes based on customer orders. Install the sale module so that you can
proceed further in this section of the chapter.
Now create a new customer order from the menu Sales → Sales → Sales Orders. Enter the following data in this
order:
  • Shop : OpenERP S.A.
  • Customer : Agrolait
  • Order Line :
    –  Product : Basic+ PC (assembly on order),
    –  Quantity : 3 PCE
    –  Procurement Method : from stock.
You have already seen that OpenERP shows you the available product stock when you have selected list mode.
The real stock is equal to the virtual stock because you have nothing to deliver to customers and you are not
waiting for any of these products to be received into stock. The salesperson then has all the information needed
to take orders efficiently.

Entering an order for three computers
Then confirm the quotation to convert it to an order. If you return to the product form, you will see the virtual
stock is now smaller than the real stock. Indeed, three products have been reserved by the order that you created,
so they cannot be sold to another customer.
Start the scheduler through the menu Warehouse → Schedulers → Compute Schedulers. Its functionality will be
detailed in Manufacturing. This manages the reservation of prod-
ucts and places orders based on the dates promised to customers, and the various internal lead times and priorities.
Now have a look at the list of deliveries waiting to be carried out using the menu Warehouse → Warehouse
Management → Delivery Orders. You find a line there for your order representing the items to be sent.
Double-click the line to see the detail of the items proposed by OpenERP.

Items on a Customer Order
You can also confirm a customer delivery using the Confirm Order button in the Sales Order. When you click the
Process button of Outgoing Deliveries, a window opens where you can enter the quantities actually delivered. If
you enter a value less than the forecasted one, OpenERP automatically generates a partial delivery note and a
new order for the remaining items. For this exercise, just confirm all the products.
If you return to the list of current orders you will see that your order has now been marked as delivered (done). A
progress indicator from 0% to 100% is shown by each order so that the salesperson can follow the progress of his
orders at a glance.

List of Orders with their Delivery State
1.3.6  Customer Delivery by Product
From this version on, you can also handle deliveries by product, even from List view. Go to Warehouse →
Products Moves → Deliver Products.
Filters allow you to easily select deliveries to be done, available deliveries and so on. One way to quickly deliver
products is to Group by Customer and select either To Do or Available.
This is very useful functionality when you send the goods to your customer for several sales orders at a time. You
can now just deliver the products, regardless of the sales order they come from.
The List view offers great flexibility and allows you to rapidly deliver products by keeping full functionality! Of
course, you can handle both partial and complete deliveries and you can add information about the production
lots and packs.
Of course, you can also accomplish this from Form view.
1.3.7  Analysing Stock
Have a look at the effect of these operations on stock management. There are several ways of viewing stocks:
  • from the Product form,
  • from the Locations,
  • from the Orders,
  • from the Reporting menu.
Open the Product form from the menu Warehouse → Product → Products and look at the list of items. You will
immediately see the following information about the products:
  • Real Stock,
  • Virtual Stock.
If you want more information, you can use the actions to the right of the form. If you click the report Stock Level
Forecast, OpenERP opens a graphical view of the stock levels for the selected products changing with time over
the days and weeks to come.
To get the stock levels by location use the button Stock by Location. OpenERP then gives you the stock of this
product for all its possible locations. If you only want to see the physical locations in your company just filter
this list using the Location Type Internal. By default, physical locations are already in red to better distinguish
them from the other locations. Consolidated (or View) locations (the sum of several locations, following the
hierarchical structure) are displayed in blue.

Stock quantities by location for a given product
You can get more details about all the Stock Moves or Future Stock Moves from the product form. You will then
see each move from a source location to a destination location. Everything that influences stock levels
corresponds to a stock move.
You could also look at the stocks available in a location using the menu Inventory Control → Locations
Structure. You can select the locations for which you want to see the hierarchy by clicking the drop-down list.
Click a location to look at the stocks by product (a wizard appears)). A location containing child locations shows
the consolidated contents for all of its child locations.
You should now check the product quantities for various locations to familiarize yourself with this double-entry
stock management system. You should look at:
  • supplier locations to see how goods receipts are linked,
  • customer locations to see how packing notes are linked,
  • inventory locations to see the accumulated profit and loss,
  • production locations to see the value created for the company.
Also look at how the real and virtual stocks depend on the location selected. If you enter a supplier location:
  • the real stock shows all of the product receipts coming from this type of supplier,
  • the virtual stock takes into account the quantities expected from these suppliers (+ real stock + quantities
    expected from these suppliers). It is the same scheme for customer locations and production locations.
From the Reporting have a look at the Dashboard and the Analysis Reports, such as Inventory Analysis and
Moves Analysis. The filters allow you to see for instance the current and future stock, for all locations or for a
given location. You can use Extended Filters and the Group by functionality to create your own reporting.
1.4  Basic Logistics Configuration
In this section you will see how to configure stock management to match your company’s needs. OpenERP can
handle many different situations by configuring it to behave as required.
1.4.1  Stock Locations
You have seen in the preceding sections that the whole of stock management is built on a concept of stock
locations. Locations are structured hierarchically to account for the subdivision of a warehouse into sections,
aisles, and/or cupboards. The hierarchical view also enables you to structure virtual locations such as production
counterparts. That gives you a finer level of analysis.
Use the menu Warehouse → Configuration → Warehouse Management → Locations then click New to define
new locations.

Defining a Stock Location
You should then give a name to your stock location. Now look at the location types.
1.4.2  Location Types
The location must have one of the following types:
  • View: shows that the location is only an organizational node for the hierarchical structure, and cannot be
    involved in stock moves itself. The view type is not usually made into a leaf node in a structure – it usually
    has children.
  • Customer: destination for products sent to customers,
  • Supplier: source of products received from suppliers,
  • Internal: locations for your own stock,
  • Inventory: the counterpart for inventory operations used to correct stock levels,
  • Production: the counterpart for production operations; receipt of raw material and sending finished
    products,
  • Procurement: the counterpart for procurement operations when you do not yet know the source (supplier or
    production). Products in this location should be zero after the scheduler run completes,
  • Transit Location for Inter-Company Transfers, used as an intermediate location in a multicompany
    environment.
You can have several locations of the same type. In that case your product, supplier and warehouse
configurations determine the location that is to be used for any given operation.
The counterparts for procurement, inventory and production operations are given by the locations shown in the
product form. The counterparts of reception and delivery operations are given by the locations shown in the
partner form. The choice of stock location is determined by the configuration of the warehouse, linked to a Shop
Sales → Configuration → Sales → Shop.

Defining Stock Locations in the Product Form

Defining Stock Locations in the Customer Form
1.4.3  Location Addresses
Each location can be given an address. That enables you to create a location for a customer or a supplier, for
example. You can then give it the address of that customer or supplier. You should indicate to OpenERP on the
partner form that it should use this location rather than the default location given to partner deliveries.
To enable you to consolidate easily at a higher level, the location definition is hierarchical. This structure is given
by the field Parent location. That also enables you to manage complex cases of product localization. For
example, you could imagine the following scenario.
One Company with Two Warehouses
A company has a warehouse in Paris and in Bordeaux. For some orders you must deliver the products from Paris,
and for others from Bordeaux. But you should also specify a fictitious warehouse that OpenERP uses to calculate
if it should deliver products from Paris or from Bordeaux.
To do this in OpenERP, you would create a third warehouse ‘France’ which consolidates the warehouses in Paris
and Bordeaux. You create the following physical locations:
  • Company
    –  Output
    *  Warehouses France
    ·  Warehouse Paris
    ·  Warehouse Bordeaux
OpenERP will then deliver the goods from the warehouse that has the ordered product in stock. When products
are available in several warehouses, OpenERP will select the nearest warehouse. To formalize the notion of
distance between warehouses you should use the geographic co-ordinates (X, Y, Z) of the different stores to
enable OpenERP to search for the nearest goods.
The same co-ordinates could also be used to structure the shelves, aisles and interior rooms in a warehouse.
1.4.4  Accounting Valuation in Real Time
If you have experience of managing with traditional software you will know the problem of getting useful
indicators. If you ask your accountant for a stock valuation or the value added by production he will give you a
figure. If you ask for the same figure from your stores manager you will get an entirely different amount. You
have no idea who is right!
In OpenERP the management of stock is completely integrated with the accounts, to give strong coherence
between the two systems. The double-entry structure of locations enables a very precise correspondence between
stocks and accounts.
Each stock movement also generates a corresponding accounting entry in an accounting journal to ensure that the
two systems can stay in permanent synchronization.
To do that, set up a general account for each location that should be valued in your accounts. If a product goes to
one location or another and the accounts are different in the two locations, OpenERP automatically generates the
corresponding accounting entries in the accounts, in the stock journal.
If a stock move will go from a location without an account to a location where an account has been assigned (for
example goods receipt from a supplier order), OpenERP generates an accounting entry using the properties
defined in the product form for the counterpart. You can use different accounts per location or link several
location to the same account, depending on the level of analysis needed.
You use this system for managing consigned stocks:
  • a supplier location that is valued in your own accounts or,
  • a location in your own company that is not valued in your accounts.
How to configure Accounting Valuation?
  • In the Product form, go to the Accounting tab and select the Real Time (automated) option for Inventory
    Valuation,
To define your accounts, you have two options. Set them on the product category, or on the product.
  • From the Information tab, for the Product Category, set the Stock Input Account, the Stock Output account
    and the Stock Variation account,
OR
  • From the Accounting tab, for the Product, set the Stock Input Account and the Stock Output account.
You can also overwrite the accounts from the Product or the Product Category by defining Stock Input and Stock
Output account for a Location.
The figure below shows the various accounts that can be used, with and without the account_anglo_saxon
module installed.

Setting up Stock Valuation Accounts
1.4.5  Linked locations
Locations in OpenERP can be linked between each other to define paths followed by products. So you can define
rules such as: all products that enter the warehouse must automatically be sent to quality control. The warehouse
and quality control are represented by two different locations.
Then when a product arrives in a location, OpenERP can automatically suggest that you send the product to
another linked location. Three link modes are available:
  • Manual Operation,
  • Automatic Move,
  • Automatic No Step Added.
The Manual Operation mode will create an internal move order to the linked location once products arrive in the
source locations. This order will wait for a confirmation of the move by a user. This enables you to have a list of
moves to do, proposed by the system and confirmed by the storesperson.
The Automatic Move mode will do the same but will not wait for a confirmation from the user. Products will
automatically be sent to the linked location without any intervening manual operation to do. This corresponds to
the case where, for simplicity, you delete a step in the process so the end user can set off the process
automatically.
The Automatic No Step Added mode will not include the additional stock move but will change the destination
move transparently to assign the linked the location. You could then assign a destination location to which you
send all the products that arrive in your warehouse. The storesperson will modify the goods receipt note.
If there is linking to do, the field Chained Location Type lets the destination location be determined. If the field is
set to ‘Customer’, the location is given by the properties of the partner form. If the field is set to fixed , the
destination location is given by the field Chained Location If Fixed.
Some operations take a certain time between order and execution. To account for this lead time, you can set a
value in days in the field Chaining Lead Time. Then the extra move (automatic or not) will be carried out several
days after the original move. If you use the mode Automatic No Step Added, the lead time is inserted directly into
the initial order. In this way you can add security lead times at certain control points in the warehouse.
1.4.6  Structuring locations
You will see in the next part that linking locations allows you you manage a whole series of complex cases in
managing production efficiently:
  • handling multiple operations for a customer order,
  • tracking import and export by sea transport,
  • managing a production chain in detail,
  • managing rented products,
  • managing consigned products.
To show these concepts, five cases of structuring and configuring these locations are given below. Many other
configurations are possible depending on needs.
1.4.7  Handling Customer Orders
Customer orders are usually handled in one of two ways:
  • item note (or preparation order), confirmed when the item is ready to send,
  • delivery order (or freight note), confirmed when the transporter has delivered the item to a customer.
You use the following stock move in OpenERP to simulate these operations:
  • Packing Note: Stock > Output,
  • Delivery Order: Output > Customer.
The first operation is automatically generated by the customer order. The second is generated by the stock
management, showing that the Output location is linked to the Customer location. The two operations will
show as waiting. If the Output location is not situated beneath the stock location you then have to move the
item from stock to the place where the item is prepared.
Some companies do not want to work in two steps, because it just seems like extra work to have to confirm a
delivery note in the system. You can then set the link mode to ‘Automatic’ to make OpenERP automatically
confirm the second step. It is then assumed all the items have automatically been delivered to the customer.
1.4.8  Linked Production
The stock_location module enables you to manage the linkages by product in addition to doing that by
location. You can then create a location structure that represents your production chain by product.
The location structure may look like this:
  • Stock
    –  Level 1
    –  Level 2
    *  Link 1
    ·  Operation 1
    ·  Operation 2
    ·  Operation 3
    ·  Operation 4
You can then set the locations a product or a routing must go through in the relevant form. All products that enter
the production chain will automatically follow the predetermined path.
You can see the location structure using Warehouse → Inventory Control → Location Structure

Logistics for a given product
To improve your logistics, you will see further on in this chapter how you can set minimum stock rules for
different locations to guarantee security stocks for assembly operators. Reports on the state of stocks in different
locations will rapidly show you the bottlenecks in your production chain.
1.5  Logistics Configuration in a Multi-Company Environment
To configure your logistics in multi-company environment you need to install stock_location module.
This module supplements the Warehouse application by adding support for location paths per product, effectively
implementing Push and Pull inventory flows.
Typically this could be used to:
  • Manage product manufacturing chains,
  • Manage default locations per product,
  • Define routes within your warehouse according to business needs, such as:
    –  Quality Control
    –  After Sales Services
    –  Supplier Returns
  • Help rental management, by generating automated return moves for rented products.
Once this module is installed, an additional Logistics Flows tab appears in the product form, where you can add
Push and Pull flow specifications.
1.5.1  Push Flows
Push flows are useful when the arrival of certain products in a given location should always be followed by a
corresponding move to another location, optionally after a certain delay.
A push flow specification indicates what location is chained with another location, as well as the parameters
used. As soon as a given quantity of products is moved in the source location, a chained move is automatically
foreseen according to the parameters set on the flow specification (destination location, delay, type of move,
journal, etc.) The new move may be automatically processed, or may require a manual confirmation, depending
on the parameters.
Suppose whenever the product CPU3 enters the Stock location, it first has to be moved to the Quality Control
location in order to maintain the quality.
Look up the product CPU3 using the menu Warehouse → Product → Products.
To have OpenERP accomplish this, configure the push flow as follows:
  • Operation: Receptions to Quality Control
  • Source Location: Stock
  • Destination Location: Quality Control
  • Automatic Move: Automatic No Step Added
  • Delay (days): 1
  • Shipping Type: Getting Goods

Push Flow Specification for Product CPU3
A push flow is related to how stock moves should be generated in order to increase or decrease inventory.
1.5.2  Pull Flows
Pull flows are a bit different from Push flows, in the sense that they are not related to the processing of product
moves, but rather to the processing of procurement orders. What is being pulled is a need, not directly products.
A classical example of Push flow is when you have an Outlet company, with a parent Company that is
responsible for the supplies of the Outlet.
[ Customer ] <- A - [ Outlet ] <- B - [ Holding ] <~ C ~ [ Supplier ]
When a new procurement order (A, coming from the confirmation of a Sales Order for example) arrives in the
Outlet, it is converted into another procurement (B, via a Push flow of the ‘move’ type) requested from the
Holding. When procurement order B is processed by the Holding company, and if the product is out of stock, it
can be converted into a Purchase Order (C) from the Supplier (Push flow of the ‘Purchase’ type). The result is
that the procurement order, the need, is pushed all the way between the Customer and Supplier.
Technically, Pull flows allow to process procurement orders differently, not only depending on the product being
considered, but also depending on which location holds the “need” for that product (i.e. the destination location
of that procurement order).
To explain pull flow for the product CPU1, first we have to configure the minimum stock rules of CPU1 for the
company OpenERP S.A. and Shop 1 using the menu Warehouse → Automatic Procurements → Minimum Stock
Rules .
For the company OpenERP S.A.:
  • Min Quantity : 10
  • Max Quantity : 50
For the company Shop 1;
  • Min Quantity : 10
  • Max Quantity : 20
Look up the product CPU1 using menu Warehouse → Product → Products in order to define the configuration of
the pulled flow.

Pull Flow Specification for Product CPU1
There are two specifications of a pull flow for product CPU1.
Specification 1:
  • Name : Receive from Warehouse
  • Destination Location : Shop 1
  • Type of Procurement : Move
  • Company : Shop 1
  • Source Location : Internal Shippings
  • Partner Address : OpenERP S.A., Belgium Gerompont Chaussee de Namur 40
  • Shipping Type : Getting Goods
  • Procure Method : Make to Order
Specification 2:
  • Name : Deliver Shop
  • Destination Location : Internal Shippings
  • Type of Procurement : Move
  • Company : OpenERP S.A.
  • Source Location : Stock
  • Partner Address : Fabien
  • Shipping Type : Sending Goods
  • Procure Method : Make to Stock
Now sell 1 unit of product CPU1 from the Shop1 and run the scheduler using menu Warehouse → Schedulers →
Compute Schedulers. Then check the stock moves for product CPU1 from the menu Warehouse → Traceability
→ Stock Moves.

Stock Move of CPU1 related to Pull Flow Specification
These moves can be explained like this:
[ Customer ] <– [ Shop 1 ] <– Internal Shippings <– Stock <– [ OpenERP S.A. ]
When the company Shop 1 sells one unit of CPU1 to a customer, its stock decreases to 10 units. According to the
minimum stock rule of the product CPU1 OpenERP generates a procurement order of 21 units of CPU1 for the
company Shop 1 (OP/00007). So 21 units of CPU1 move from company OpenERP S.A. to Shop 1 according to
their internal configuration of Source and Destination Locations.
A pull flow is related to how the procurement process runs in order to find products to increase or decrease
inventory.
1.6  Import / Export
Managing import / export with foreign companies can sometimes be very complex. Between a departure port and
the destination company, products can get stopped for several weeks at sea or somewhere in the numerous
transportation stages and customs. To manage such deliveries efficiently it is important to:
  • know where your products are,
  • know when they are likely to arrive at their destination,
  • know your value in transit,
  • follow the development of the different steps.
Linked locations in OpenERP enable you to manage all this rather elegantly. You can use a structure like this:
  • Suppliers
    –  European Suppliers
    –  Chinese Suppliers
  • In transit
    –  Shanghai Port
    –  Pacific Ocean
    –  San Francisco Port
    –  San Francisco Customs
1.6.1  Stock
The transit locations are linked between themselves with a manual confirmation step. The internal stock move is
validated at each port and customs arrival. OpenERP prepares all the linked moves automatically.
You can use the lead times between different locations to account for real delays. Your lead times and stock
forecasts are calculated by OpenERP to estimate the arrival of incoming products so that you can respond to a
customer’s needs as precisely as possible.
You can also value the products in transit in your account depending on the chosen stock location configuration.
1.6.2  Rental Locations
You can manage rental locations in OpenERP very simply using the same system of linked locations. Using the
module stock_location you can set a return date for rental items sent to customer location after a certain
rental period.
Then the set of real and virtual stocks is maintained daily in real time. The different operations such as delivery
and receipt after a few days are automatically suggested by OpenERP which simplifies the work of data entry.
You then have the product list found in the customer locations and your own stock in your stock location. The list
of waiting goods receipts is automatically generated by OpenERP using the location links.
Suppose you want to give a product (PC3) on rent to your customer (Axelor) for 30 days. Two stock movement
entries are needed to manage this scenario:
1.  Product goes out from Stock (your company’s location) to Axelor - Rental Location (your customer
location).
2.  Product will be returned into Stock (your company’s location) from Axelor - Rental Location (your
customer location) after 30 days.
To manage rental products by linking locations, configure a rental location (Axelor - Rental Location) as shown
in the following figure using the menu Warehouse → Configuration → Warehouse Management → Locations.

Configuration of a rental location ‘Axelor - Rental Location‘
Using the menu Warehouse → Traceability → Stock Moves, you can create a stock movement entry from Stock to
Customer Location (Axelor - Rental Location) in OpenERP for a rental product (PC3).

Stock movement entry to send the product ‘PC3‘ to the customer location
The stock movement entry from Customer Location (Axelor - Rental Location) to Stock is generated
automatically on the proper Scheduled Date by OpenERP when you have confirmed the previous stock
movement entry by clicking the Process Now button.
The same principle is used for internal stock to generate quality control for certain products.
1.6.3  Consigned Products
The principle of linked locations is used to manage consigned products. You can specify that certain products
should be returned to you a certain number of days after they have been delivered to customers.
When the products have been delivered, OpenERP automatically creates goods receipts for the consigned
product. The specified date is obviously approximate but enables you to forecast returns.
1.7  Warehouses
Warehouses are designed for physical locations from which you can deliver to the customer and to which you
receive raw materials. When you buy products from a supplier you should take account of the Warehouse you use
for this purchase. This also enables the end user to not have to choose from a list of locations but simply a real
warehouse.
Use the menu Warehouse → Configuration → Warehouse Management → Warehouses, then click New to
configure a new warehouse.
A warehouse is defined by a link between three locations:
  • The Location Stock field shows the place of products available for delivery to a customer directly from this
    warehouse. Availability is given by all the products in that location and any child locations.
  • The Location Input field shows where ordered products are received from a supplier in that warehouse. It
    can be the same as the stock location if, for example, you want to do a quality control operation on your
    incoming raw materials.
  • The Location Output field (called Output in the demonstration database) is designed as a buffer zone in
    which you store all the items that have been picked, but not yet delivered to a customer. You are strongly
    advised not to put this location within the stock hierarchy but instead at a higher level or at the same level.

Warehouse Parameters
You can also set an address for the warehouse. This address should ideally be an address of your company. Once
the warehouse has been defined it can be used in:
Minimum stock rules,
Supplier orders,
Customer orders (using the definition of a point of sale, which is linked to a warehouse).
1.7.1  Automatic Procurement
Several methods of automatically procuring products can be carried out by OpenERP:
the workflow used by products that have the procurement mode Make to Order,
using minimum stock rules for Make to Stock products,
using the master production schedule for Make to Stock products.
The last two methods are described below.
1.7.2  Minimum Stock Rules
To automatically make stock replenishment proposals, you can use minimum stock rules. To do this use the
menu Warehouse → Automatic Procurements → Minimum Stock Rules.
The rule is the following: if the virtual stock for the given location is lower than the minimum stock indicated in
the rule, the system will automatically propose a procurement to increase the level of virtual stock to the
maximum level given in the rule.

List of Minimum Stock Rules
We underline that the rule is based on virtual quantities and not just on real quantities. It takes into account the
calculation of orders and receipts to come.
Take the following example:
  • Products in stock: 15
  • Products ordered but not delivered: 5
  • Products in manfacturing: 2
The rules defined are:
  • Minimum stock: 13
  • Maximum stock: 25.
Once the rules have been properly configured, the purchasing manager only needs to look at the list of orders for
confirmation with the supplier using the menu Purchases → Purchase Management → Requests for Quotation.
You can also set multiple quantities in the minimum stock rules. If you set a multiple quantity of 3 the system
will propose procurement of 15 pieces, and not the 13 it really needs. In this case it automatically rounds the
quantity upwards.
In a minimum stock rule, when you indicate a warehouse it suggests a stock location by default in that warehouse.
You can change that location by default when the scheduler completes, by location and not by warehouse.
1.8  Scheduling
The master production plan, sometimes called the MPS (Master Production Schedule), enables you to generate
forecasts for incoming and outgoing material. It is based on forecasts of inputs and outputs by the logistics
manager.

To be able to use the production plan, you must install the stock_planning module.
1.8.1  Sales Forecasts
The first thing to do to work with a production plan is to define the periods for stock management. Some
companies plan daily, others weekly or monthly.
Go to the menu Sales → Configuration → Stock and Sales Periods → Stock and Sales Periods. A window
appears enabling you to automatically define the next periods that will be provided for stock management.

Defining Periods for Stock Management
Salespeople can then enter their sales forecasts by product and by period using the menu Sales → Sales Forecasts
→ Sales Forecasts. The forecasts can be made by quantity or by value. For a forecast by amount OpenERP
automatically calculates for you the quantity equivalent to the estimated amount. This can be modified manually
as needed before completion.

Sales Forecast to Help Create a Master Production Plan
1.8.2  Production Plan
The manager responsible for logistics then plans receipts (manufacturing or purchases) and outgoings
(consumption or customer deliveries) by period. Go to the menu Warehouse → Stock Planning → Master
Procurement Schedule.
For each period and product, OpenERP gives you the following information:
Stock estimated at the end of the period, calculated as stock in the following period less the total estimated
outgoings plus total estimated inputs,
Closed entries, coming from production or confirmed purchases,
Forecast inputs for the period, calculated using the incoming entries less the closing amounts,
Planned inputs entered manually by the logistics manager,
Closed outgoings which are the consumption of manufacturing waiting and deliveries to be made to
customers,
Forecast outgoings, calculated from the planned outgoings, less the closing amounts,
Planned outgoings, manually entered by the logistics manager,
Sales forecasts, which represent the sum of forecasts made by the salespeople.

The Master Production Schedule (MPS)
The production plan enables the logistics manager to play with the forecasted receipts and outgoings and test the
impact on the future stock for the product concerned. It enables you for example to check that the stock does not
fall below a certain level for that product.
You can also open the production plan for past periods. In this case OpenERP shows you the real stock moves,
by period for forecast reports.
If you do not have automated procurement rules for a product you can start procurement at any time based on the
estimates of the production plan. To do this press the button Procure Incoming Left (i.e. remaining) on the
Master Procurement Schedule. OpenERP plans procurement for an amount equal to the entries forecast.
1.9  Management of Lots and Traceability
The double-entry management in OpenERP enables you to run very advanced traceability. All oper-
ations are formalized in terms of stock moves, so it is very easy to search for the cause of any gaps in stock moves.
1.9.1  Stock Moves
Use the menu Warehouse → Traceability → Stock Moves to track past stock transactions for a product or a given
location. All the operations are available. You can filter on the various fields to retrieve the operations about an
order, or a production activity, or a source location, or any given destination.

History of Stock Movements
Each stock move is in a given state. The different possible states are:
  • Draft : the move so far had no effect in the system. The transaction has not yet been confirmed,
  • Confirmed : the move will be done, so it will be counted in the calculations of virtual stock. But you do
    not know whether it will be done without problem because the products have been reserved for the move,
  • Validated : the move will be done and the necessary raw materials have been reserved for the
    transaction,
  • Done : the stock move has been done, and entered into the calculations of real stock,
  • Waiting : in the case of transactions From  Order, this state shows that the stock move is blocked
    waiting for the end of another move,
  • Cancelled : the stock move was not carried out, so there is no accounting for it in either real stock or
    virtual stock.
Delivery orders, goods receipts and internal picking lists are just documents that group a set of stock moves. You
can also consult the history of these documents using the menu Warehouse → Traceability → Packs.
1.9.2  Lots
OpenERP can also manage product lots. Two lot types are defined:
  • Production lots (batch numbers) are represented by a unique product or an assembly of identical products
    leaving the same production area. They are usually identified by bar codes stuck on the products. The
    batch can be marked with a supplier number or your own company numbers.
  • Tracking numbers are logistical lots to identify the container for a set of products. This corresponds, for
    example, to the pallet numbers on which several different products are stocked.
These lots can be encoded onto all stock moves and, specifically, on incoming shipments lines, internal moves
and outgoing deliveries.

Entering a Line for Production Receipt
To enter the lot number in an operation you can use an existing lot number or create a new pack. A production lot
(batch number) is used for a single product. A tracking number can be used several times for different products,
so you can mix different products on a pallet or in a box.
You can also specify on the product form the operations in which a lot number is required. You can then compel
the user to set a lot number for manufacturing operations, goods receipt, or customer packing.
You do not have to encode the lot number one by one to assign a unique lot number to a set of several items. You
only need to take a stock move for several products line and click the button Split in Production Lots. You can
then give a lot number prefix (if you want) and OpenERP will complete the prefix in the wizard with a continuing
sequence number. This sequence number might correspond to a set of pre-printed barcodes that you stick on each
product.

Splitting a Lot into uniquely Identified Parts
1.9.3  Traceability
If you key in the lot numbers for stock moves as described above you can investigate the traceability of any given
lot number. Go to the menu Warehouse → Traceability → Production Lots, or Warehouse → Traceability →
Packs.
Search for a particular lot using the filters for the lot number, the date or the product. Once you can see the form
about this lot, several actions can be performed:
  • Upstream Traceability: from supplier through to customers,
  • Downstream Traceability: from customer back to suppliers,
  • Stock in all the physical and virtual locations.
 
Tracing Upstream in Make to Order

Tracing Downstream in Make to Stock
Finally, on a lot, you can enter data on all the operations that have been done for the product. That keeps a useful
history of the pre-sales operations.
1.10  Management by Journal
You can manage stock through journals in the same way as you can manage your accounts through journals. This
approach has the great advantage that you can define journals in various ways to meet your company’s needs.
For example, a large company may want to organize deliveries by department or warehouse. You can then create
a journal and a manager for each department. The different users can work in a journal as a function of their
position in the company. That enables you to better structure your information.
A company doing a lot of transport can organize its journals by delivery vehicle. The different delivery orders
will then be assigned to a journal representing a particular vehicle. When the vehicle has left the company, you
can confirm all the orders that are found in the journal all at the same time.
1.10.1  The different journals
Install the Reconfigure option Invoicing Journals for Sales Management or the sale_journal module to
work with different journals. This adds three new concepts to OpenERP:
  • Invoicing journals,
  • Order journals,
  • Delivery journals.
Invoicing journals (Sales → Configuration → Sales → Invoice Types) are used to assign purchase orders and/or
delivery orders to a given invoicing journal. Everything in the journal can be invoiced in one go, and you can
control the amounts by journal. For example you can create the following journals: daily invoicing, end-of-week
invoicing and monthly invoicing. It is also possible to show the invoicing journal by default in the partner form.
Set the Invoicing Method to Grouped (one invoice per customer) or Non Grouped (individual invoices) according
to your needs.
Order journals look like orders and are automatically transferred to orders for the corresponding items. These
enable you to classify the orders in various ways, such as by department, by salesperson, or by type. Then if a
salesperson looks at her own journals after an order she can easily see the work on current items compared with
her own orders.
Finally the delivery journals are used to post each item into a delivery journal. For example you can create
journals dated according to customer delivery dates (such as Monday’s deliveries, or afternoon deliveries) or
these journals could represent the day’s work for delivery vehicles (such as truck1, truck2).
1.10.2  Using the journals
You will now see how to use the journals to organize your stock management in practice. After installing the
module sale_journal look at the list of partners. In the tab Sales and Purchases on any of them you will
now see the field Invoicing Method.

Partner Form in Invoicing Mode
You can create a new Invoicing Journal for a partner on the fly. You can show if the invoices should be grouped
or not after you have generated them in the journal. Create a second invoicing journal End-of-Month
Invoicing which you can assign to another partner.

Defining an Invoicing Journal
Then enter the data for some orders for these two partners. After entering these order data, the field Invoicing
Mode is completed automatically from the partner settings. Put these orders into the Invoicing Mode based on
items in the second tab.
Look at the History tab of the Sales order to the Picking List that has been created. The field Invoicing Mode is
automatically shown there. Confirm the different orders in the list.
At the end of the day, the invoicing supervisor can display the list by journal. Go to the menu Sales → Invoicing
→ Lines to Invoice. Choose the invoicing journal and all the lists of orders to invoice will then open in list view.
You can automatically carry out invoicing by clicking the action Make Invoice (the gears symbol in the
application client).
At the end of the month the invoicing management does the same work but in the journal ‘month-end invoicing’.
You can also enter a journal to confirm / cancel all the orders in one go. Then you can do several quotations,
assign them to a journal and confirm or cancel them at once.

View of an Order Journal
1.11  Advanced Elements of Stock Management
In this section you will enter the details for stock management and control.
1.11.1  Requirements Calculation / Scheduling
Requirements calculation is the calculation engine that plans, prioritises and starts the automated procurement as
a function of rules defined in the products.
1.11.2  Just in Time
By default, scheduling starts automatically once a day. You should make this run be executed overnight to ensure
that the system does not slow down under a heavy load of scheduling when you are also trying to use it
interactively yourselves.
To set the start time for the scheduler, go to the menu Administration → Configuration → Scheduler → Scheduled
Actions. Select the rule called ‘Run mrp scheduler’ and modify the date and time of the next execution. Some
companies want to plan orders progressively as they are entered so they do not wait until procurement orders are
planned the next day. Install the module mrp_jit to handle this. Once it is installed, each requirement (that
could result in a Production or Purchase Order) will be planned in real time as soon as it has been confirmed.
Then if you make a customer order with a product that is Make  To  Order the quotation request to a supplier
will immediately be generated.
This mode is not always sensible. Each order is processed immediately when confirmed. So if an order is to be
delivered in three months the scheduler will reserve goods in stock for each order once it has been confirmed. It
would have been more sensible to leave these products available for other orders.
If a Purchase Order’s Invoicing Control is configured From  Order, the scheduler will immediately create the
corresponding supplier quotation request. It would have been preferable to delay for several weeks if you could
have used the lead time to group the purchase with other future orders.
So the negative effects of working with the Just in Time module are:
Poor priority management between orders,
Additionally stocked products.
1.11.3  Planning
You have seen that most OpenERP documents can be changed in a planning view. It is the same for deliveries
and goods receipts. You can put them into a calendar view at any time to plan your deliveries or goods receipts.

Planning the Deliveries of Customer Products
Planned dates on a packing order are put in each stock move line. If you have a packing order containing several
products not all of the lines necessarily need to be delivered the same day. The minimum and maximum dates in
a packing order show the earliest and latest dates on the stock move lines for the packing.
If you move a packing order in the calendar view, the planned date in the stock move lines will automatically be
moved as a result.
1.11.4  Managing Partial Deliveries
Partial deliveries, sometimes called Back Orders, are generated automatically by OpenERP. When you confirm a
customer delivery or the receipt of products from suppliers, OpenERP asks you to confirm the quantity delivered
or received.
If you leave the quantities alone, OpenERP confirms and then closes the order for delivery or receipt. If you
modify a quantity, OpenERP will automatically generate a second delivery or goods receipt document for the
remaining quantities. The first will be confirmed and the second will remain in the list of waiting deliveries (or
receipts).

Confirmation Screen for Delivered Quantities
When you open the list of current deliveries, you find the field Back Order of which shows the reference number
of the first delivery sent to the customer. That enables you to quickly find the deliveries for partial orders each
day so that you can treat them as a priority.
1.11.5  Receiving Supplier Products
OpenERP supports three approaches to control data entry for products ordered from suppliers:
Manual data entry,
  • Using the goods receipt documents pre-generated by the system,
  • Selecting from all the products waiting from the supplier, independently from goods receipt documents.
  • You can see how the configuration of the supplier order affects receipts in detail in Driving your Purchases.
1.11.6  Manual Data Entry of Goods Receipt
To enter data about goods receipt manually go to the menu Warehouse → Warehouse Management → Incoming
Shipments and click the New button. Then enter the necessary data manually in the goods receipt form.

Manual Data Entry for Product Receipt
1.11.7  Confirming pre-generated Goods Receipt Documents
If you use Purchase Orders in OpenERP, product receipts are automatically generated by the system when the
purchase order is confirmed. You do not have to enter any date, just confirm that the quantities ordered match the
quantities received.
In this case OpenERP generates a list of all products waiting to be received from the menu Warehouse →
Warehouse Management → Incoming Shipments and applying proper filter. Group by State to find all incoming
shipments with the corresponding state.

List of Items Waiting to be Received
Then you just look for the corresponding entry using the supplier name or order reference. Click it and confirm
the quantities. If it shows you quantities that differ from the control form, OpenERP will automatically generate
another receipt document that will be set open, waiting for the remaining deliveries. You can leave it open or
cancel it if you know that products missed by your supplier will never be delivered.
1.11.8  Confirmation by Selecting Products Waiting
The approach shown above is very useful if goods receipts correspond to the original orders. If your suppliers
deliver items that do not necessarily coincide with the orders, however, it is easier to work by products received
rather than by orders.
In this case you can manually create a new goods receipt using the menu Warehouse → Products Moves →
Receive Products. OpenERP opens a list of all the receivable/received product from that supplier and you can
automatically add some or all of them to your form. You can filter receivable products based on state and confirm
it. This method of data entry is very useful when you are entering goods received at one time from several orders.
1.11.9  Product Routing
You should install the stock_location module if routing products to customers, from suppliers or in your
warehouse is determined by the identity of the product itself.

Managing the Paths from one Location to Another in a Product Form
This will let you configure logistics rules individually for each product. For example, when a specific product
arrives in stores it can automatically be sent to quality control. In this case it must be configured with rules on the
product form. The fields that make up those rules are:
  • Source Location: the rule only applies if a product comes from this location,
  • Destination Location: the rule only applies if a product ends up in this location,
  • Type of move: automatic, manual, automatic with no steps,
  • Lead time for move,
  • Name of operations: a free text field which will be included in the automatic stock move proposed by
    OpenERP.
There are two main logistic flows:
  • Pushed Flows
  • Pulled Flows
Push flows are useful when the arrival of certain products in a given location should always be followed by a
corresponding move to another location, optionally after a certain delay. The original Warehouse application
already supports such Push flow specifications on the Locations themselves, but these cannot be refined per
product.
Pull flows are a bit different from Push flows, in the sense that they are not related to the processing of product
moves, but rather to the processing of procurement orders. What is being pulled is a need, not directly products.
You will now see some examples of using these locations and logistics by product:
  • A rentable product,
  • A product bought in China, following its freight by ship from port to port,
  • A product that you want to send to quality control before putting it in stocks.
Example 1: A rentable product
A rentable product is just a product delivered to a customer that is expected to be returned in a few days time.
When it has been delivered to the customer, OpenERP will generate a new goods receipt note with a forecast date
at the end of the rental period. So you generate a list of goods pending receipt that you confirm when they are
returned to your stores. To do this you should configure a product with the following rules:
Example  Product  For Rental
Then when the product is delivered to the customer, OpenERP automatically generates a goods receipt form in
draft state ready for returning it to Stock. This is due in 15 days time. With such a system your forecasts and
stock graphs can always be correct in real time.
Example 2: Management of imports by sea
To manage products that follow a complex logistical import path by sea and then into customs, create as many
‘Supplier’ locations as there are steps, then create rules to move the product from one place to the other during
the purchase.
Take a product that has been bought in China and delivered to you stores in Brussels, Belgium. Import by sea
takes around 7 weeks and must go through the following steps:
  • Delivery from the supplier to the port of Shanghai: 2 days,
  • Sea transport from Shanghai to the port of Antwerp: 1 month,
  • Customer at the port of Antwerp: 2 weeks,
  • Delivery by truck from the port of Antwerp to your stores: 3 days.
You should track the movement of your goods and enter all the documents as each move is made so that you
know where your goods are at any moment, and can estimate when they are likely to arrive in your stores. To do
this, create all the locations for the intermediate steps:
  • Shanghai Port,
  • Antwerp Port,
  • Antwerp Customs.
Finally, in the product form, create the following rule to show that when purchased, the goods do not arrive at
your stores directly, but instead at the port of Shanghai. In this example the stores are configured to enter all the
products in a location called ‘Input’.
Rule to move products automatically to Shanghai Port
OpenERP will then change the usual product receipt (which has them arriving in the Input location) to a delivery
from this supplier to the external port. The move is automatically carried out because operations at this level are
too labour-intensive to be done manually.
You then have to create a rule on the product form to move it from one location to another:
Rule to move products manually from Shanghai Port to Antwerp Port
Rule to move products manually from Antwerp Port to Antwerp Customs
Rule to move products manually from Antwerp Customs to Stock
Once the rules have been configured, OpenERP will automatically prepare all the documents needed for the
internal stock movements of products from one location to another. These documents will be assigned one after
another depending on the order defined in the rules definition.
When the company received notification of the arrival at a port or at customers, the corresponding move can be
confirmed. You can then follow, using each location:
where a given goods item can be found,
quantities of goods awaiting customs,
lead times for goods to get to stores,
the value of stock in different locations.
Example 3: Quality Control
You can configure the system to put a given product in the Quality Control bay automatically when it arrives in
your company. To do that you just configure a rule for the product to be placed in the Quality Control location
rather than the Input location when the product is received from the supplier.
Rule to move products manually from Input to Quality Control
Once this product has been received, OpenERP will then automatically manage the request for an internal
movement to send it to the Quality  Control location.