Wednesday, 18 December 2013

Hide field in tree view based on condition

Hide Field in Tree view

In tree view we know how to put domain or attrs to visible or invisible any field,

But, if we want to hide particular field in tree view based on type or state means based on any condition , then its hard to hide as we cannot use attrs to hide as attrs hide only value not a field.

So, its need to put some condition like below as its get value from context and check.

invisible="context.get('picking_type', False) in ['in']"

Version : V8

Monday, 16 December 2013

Call xmlrpc when want to access functional field

Hello All,

In openerp sometimes we need to update database value on basis of some field value, we can direct do it but if we want to apply in old data then we use sql query and we update but if there is functional field which is not stored in database but you need to update data base on it. At that time we can do it by xmlrpc.

Here, i defined xmlrpc script in which if there is Purchase order which is 'received' and 'invoiced' but still not in 'done' state by this script purchase order gone in 'done' state.

Purchase Order Done :

import xmlrpclib
import time

username = 'admin' #the user
pwd = 'a'      #the password of the user
dbname = 'test'    #the database
model = 'purchase.order' # model name

# Get the uid
sock_common = xmlrpclib.ServerProxy ('http://localhost:8069/xmlrpc/common')
uid = sock_common.login(dbname, username, pwd)

#replace localhost with the address of the server
sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/object')

# argument passed to search
args = [('shipped', '=', True), ('state', 'not in', ['done']), ('invoice_method', 'in', ['manual','picking'])]
# search ids
ids = sock.execute(dbname, uid, pwd, model, 'search', args)

# READ functional field
ids_f = []
fields = ['invoiced']
po_ord = sock.execute(dbname, uid, pwd, model, 'read', ids, fields)
for re in po_ord :
    if re['invoiced'] :

# write state done
values = {'state':'done'}
results = sock.execute(dbname, uid, pwd, model, 'write', ids_f, values)

if ids_f :
    print "Successfully applied records ",ids_f
    print "No records found to update"


Thursday, 28 November 2013

Add tag in advance search

Hello All,

In openerp there is functionality so we can see the field with combination of more than one field, means field one is display with field 1+ field 2
ex. field 1 value = 'My Account' field 2 = '007' now with the use of name_search method we can concete both fields and its look like 'oo7/My Account' . Now, in this case its became very hard to search so openerp provides one way as a put a tag on search. So, its became eady to you what you want to search. Tags look like , 'name:YOUR_VALUE' , 'code:YOUR_VALUE'..

To do, you need to add following code,

+            if name and str(name).startswith('name:'):
+                acc_name = name.split(':')[1]
+                args += [('name', operator, acc_name)]
+                name = False
+            if name and str(name).startswith('code:'):
+                code = name.split(':')[1]
+                args += [('code', operator, code)]
+                name = False

You  can use it like following way,


Tuesday, 15 October 2013

Set reply to in OpenERP

How to set reply to in OpenERP ?

I think you all are searching about how to use reply-to in OpenERP 7.0 ?

If we are about to set mail configuration of any company than there is mail alias in picture we already talked about mail alias as how to set and configure mail alias and how it works.
Mail Alias in OpenERP

But, the problem when we send a mail to any customer and if customer reply to that mail at that time there may be chances to loose
mail so we need to configure reply to proper so whenever customer reply than it will take the reply to mail.

so, there are two ways either we hard code for reply to and another way little bit hacking like set defaults from web UI .

Here, i defined some steps so admin can easily configure default.

1. Just login with admin user.
2. Activate developer mode .

3. Now, go to mails and create a new mail and set reply to any mail you want to set in reply to.

4. open debug mode and select "Set Defaults" so it will open one dialog from that select reply to = XXXXX and set as per requirement for all users or only one.

Now, You can test there is reply to added in mail....

.. Enjoy ..

Friday, 13 September 2013

Only Tax invoice with OpenERP

Today , concern about how to create any invoice with only tax amount.

In real business sometimes its needed to create invoice where there is no any products but only vat or any tax.

Ex. Suppose in shipping company which contain an invoice line relating to import VAT. That means that the VAT amount is not a fixed percentage of the invoice.

So, how we can enter supplier invoice ?

Here are some steps that may be useful to you.

1. Set up Tax through(Accounting > Configuration > Tax).
    And in it just set tax type to "Python code"
    And set as follow(in result just assign price_unit direct no need to multiply).
Python Code
# price_unit
# product: product.product object or None
# partner: res.partner object or None

result = price_unit
Python Code (reverse)
# price_unit
# product: product.product object or False

result = price_unit
And just tick "Tax included in price" (so it consider as the tax already included in price).
2. Now, its time to create a new product named like "VAT" service type.
    Under the Accounting tab in product add supplier Taxes to be the created tax.
3. Now, create a supplier invoice and in it select created product VAT, and you can edit unit price and set it as per requirement. 
  So, you can see the whole amount treat as tax and you can validate invoice.

Why we have to go through this process ?? Because in OpenERP will not allow you to create any invoice without invoice line.

Hope this will help to you.


Tuesday, 10 September 2013

Dynamically view in OpenERP

Creating Views Dynamically in OpenERP

Create dynamic view in OpenERP

Sometimes, its needed to add or remove or edit some properties of fields in dynamic mode. Normally, we can manage view from xml.

So, in OpenERP there is fields_view_get() method in which we can divert view or do some operation.

Another thing some times its needed to redirect depending on state or else.

Example : 

Case 1 : We have two form view parent and child, now from the tree view on the basis of state we have to call either parent or child.
          def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):      
              if view_type == 'form':
                  if state == 'A' :
                      view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name', '=', 'parent.form')])
                  elif state == 'B':
                      view_id = self.pool.get('ir.ui.view').search(cr,uid,[('name', '=', 'child.form')])
              res = super(my_module,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)

Case 2 : We have to change some fields using fields_view_get()

     def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
        if context is None:
            context = {}
        res = super(account_invoice_line,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
        if context.get('type', False):
            doc = etree.XML(res['arch'])
            for node in doc.xpath("//field[@name='product_id']"):
                if context['type'] in ('in_invoice', 'in_refund'):
                    node.set('domain', "[('purchase_ok', '=', True)]")
                    node.set('domain', "[('sale_ok', '=', True)]")
            res['arch'] = etree.tostring(doc)
        return res


Friday, 23 August 2013

Configure Proxy server

Configure Proxy server

Configuration Ubuntu :
(Three Steps to configure proxy server)

Go etc -> apache2 -> sites-available

    <VirtualHost *:80>
        ServerName pinakin
        ServerAdmin webmaster@localhost

         <Proxy *>
                Order deny,allow
                Allow from all
        ProxyRequests Off
        ProxyPass / http://localhost:8069/
        ProxyPassReverse / http://localhost:8069/
        #ProxyHTMLURLMap / http://localhost:8069/ /http://pinakin/

        ErrorLog /var/log/apache2/webclient-error.log
        CustomLog /var/log/apache2/webclient-access.log combined

Step 1 : Install Apache 2
      -  $ sudo apt-get install apache2
                 [sudo] password for tiny:
                 Reading package lists... Done
                 Building dependency tree    
                 Reading state information... Done
                 apache2 is already the newest version.
                 The following packages were automatically installed and are no longer required:
                 appmenu-gtk linux-headers-2.6.35-22 linux-headers-2.6.35-22-generic libxdot4
                 Use 'apt-get autoremove' to remove them.
                 0 upgraded, 0 newly installed, 0 to remove and 189 not upgraded.

Step 2 : Give permission to edit and enable module proxy, header or etc

     -  $ sudo chmod 777 /etc/apache2/sites-available/pinakin
     -  $ sudo a2enmod headers
               Enabling module headers.
               Run '/etc/init.d/apache2 restart' to activate new configuration!
     -  $ sudo a2enmod proxy
               Enabling module proxy.
               Run '/etc/init.d/apache2 restart' to activate new configuration!
     -  $ sudo a2enmod proxy_connect
               Considering dependency proxy for proxy_connect:
               Module proxy already enabled
               Enabling module proxy_connect.
               Run '/etc/init.d/apache2 restart' to activate new configuration!
     -  $ sudo a2enmod proxy_ftp
               Considering dependency proxy for proxy_ftp:
               Module proxy already enabled
               Enabling module proxy_ftp.
               Run '/etc/init.d/apache2 restart' to activate new configuration!
     -  $ sudo a2enmod proxy_http
              Considering dependency proxy for proxy_http:
              Module proxy already enabled
              Enabling module proxy_http.
              Run '/etc/init.d/apache2 restart' to activate new configuration!
     -  $ sudo a2enmod ssl
              Enabling module ssl.
              See /usr/share/doc/apache2.2-common/README.Debian.gz on how to configure SSL and
              create self-signed certificates.
              Run '/etc/init.d/apache2 restart' to activate new configuration!
     -  $ sudo a2ensite default-ssl
              Enabling site default-ssl.
              Run '/etc/init.d/apache2 reload' to activate new configuration!
     -  $ sudo a2dissite
              000-default  default-ssl
     -  $ sudo a2dissite 000-default
              Site default disabled.
              Run '/etc/init.d/apache2 reload' to activate new configuration!
     -  $ sudo a2ensite endicus
              Enabling site endicus.
              Run '/etc/init.d/apache2 reload' to activate new configuration!
     -  $ sudo /etc/init.d/apache2 restart
             \Syntax error on line 12 of /etc/apache2/sites-enabled/endicus:
              Invalid command 'ProxyHTMLURLMap', perhaps misspelled or defined by a module not
              included in the server configuration
     -  $ sudo /etc/init.d/apache2 restart
             Syntax error on line 12 of /etc/apache2/sites-enabled/endicus:
             Invalid command 'ProxyHTMLURLMap', perhaps misspelled or defined by a module not                      included in the server configuration
     -  $ sudo /etc/init.d/apache2 restart
             * Restarting web server apache2              
            [ OK ]

Step 3 : To show list of hosts available

     -   $ sudo nano /etc/hosts
              [sudo] password for tiny:       localhost.localdomain   localhost
::1     test    localhost6.localdomain6 localhost6       test       pinakin       v6       v7


Thursday, 15 August 2013

Work with analytic Distribution in OpenERP

Analytic Distribution

Analytic Distribution is mainly used for spreading/dividing your expense/income in various analytic account (i.e. cost account) in OpenERP.
Work with analytic Distribution in OpenERP

There are various application of analytic distribution in real business case.
Let's take one business case in which a company wants to distribute it's income between various departments:
A IT company provide consultancy services for the software solution.
The company is interested to divide it's income real-time between it's main three departments 

1. Analysis and Design 2. Coding and testing 3. Deployment.

It also wants that when customer invoice is created for particular client PROJECT, the invoice amount will be divide in these three departments as below:

1. Analysis and Design: 50%
2. Coding and testing : 30%
3. Deployment : 20%
You can easily configure this requirement in OpenERP using Analytic Distribution.
Just create three analytic account (Analysis and Design a/c, Coding and testing a/c, Deployment a/c). Make sure that the parent account of these accounts is the client project's analytic account.
Now configure Analytic Distribution by adding these three analytic accounts with their respective part in percentage.
Add this analytic distribution at the time of encoding customer invoice line.
Now validate that invoice and check the "Analytic Chart of Account" in order to check the effect of Analytic Distribution.


Monday, 22 July 2013

Unable to create lead from email

Hello All,

I think you all are facing problem of lead/helpdesk. As its not created automatically mail.

You have configured your mail server correctly action to create lead correctly set but still all
mail are not fectched or all mails are not create lead/helpdesk right ?

Some mails create messages instead of new lead ?

So, there may be chances you have configured mail server thats silently broken.

So, avoid this kind of stuff you can just check your mail server and check your aliases both are same , means here i give you example.

in your mail server : for fetching incoming mail.

now in your users if there is similar 'nayi.pinakin' than its create problem.

So, check your aliases and be sure there is fetch mail server and user are not same.


Sunday, 14 July 2013

Google Alert

Do you know google alert ?

When you are about to search something but there is no any related document still published ,
in this case you can create google alert that will alert you if there is similar like document on web.

What a fantastic facility by Google !!!

So, what we say  "Thanks Google !!"

View Pinakin Nayi's profile on LinkedIn

Thursday, 11 July 2013

Work with different address in OpenERP 7.

Work with different address in OpenERP 7.

OpenERP 7 gives you facility so you can set different addresses.
There are mainly three types of addresses used in any company there are as follow :

- Main company address
- Invioce Address
- Shiping Address

Steps :

 - Create one customer set it as company .
 - add address as company address
 - Create new conact (under customer form contact Tab)
 - Choose address Type and define different addresses .

Here i created video that will showing same.


Wednesday, 10 July 2013

Install web-cam on your ubuntu machine

Do you wanna install web-cam on your ubuntu machine ?

Just run one command and you can enjoy ...

Go to Application > Accessories  > Terminal
Type command :

 sudo apt-get install cheese

After installation :

Go to Application > Sound & video > Cheese Webcam Booth

.. Enjoy ...

Tuesday, 9 July 2013

How to increase your PC speed through swap memory ??

How to increase your PC speed through swap memory ??

Specially in UBUNTU :

Here i described some of step that all are helpful to you to create swap memory and of course speed up your PC.

Check for Swap Space

swapon -s

An empty list (for first time if there is no any already created swap):
Filename    Type  Size Used Priority

Create and Enable the Swap File

Now it’s time to create the swap file itself using the dd command :
sudo dd if=/dev/zero of=/swapfile bs=1024 count=512k

“of=/swapfile” designates the file’s name. In this case the name is swapfile. 

Subsequently we are going to prepare the swap file by creating a linux swap area:
sudo mkswap /swapfile

The results display something like:
Setting up swapspace version 1, size = 262140 KiB
no label, UUID=103c4545-5fc5-47f3-a8b3-dfbdb64fd7eb

Finish up by activating the swap file:
sudo swapon /swapfile

You will then be able to see the new swap file when you view the swap summary.
swapon -s
Filename    Type  Size Used Priority
/swapfile                               file  262140 0 -1

This file will last on the virtual private server until the machine reboots. 
You can ensure that the swap is permanent by adding it to the fstab file.

Open up the file:
sudo nano /etc/fstab

Paste in the following line:
 /swapfile       none    swap    sw      0       0 


Wednesday, 3 July 2013

Mail Alias with OpenERP 7

Mail alias in OpenERP 7

I think lots of people have confusion over mail alias including me.

So, here i try to describe mail alias in OpenERP.
For mail configure in OpenERP

Steps :

- First of all configure mail servers both incoming and outgoing.
- now from the Setting > General Setting configure "Alias Domain"(catch-all email domain redirected to this openerp server domain)

Now very important thing how openerp mail alias work

so in this case you have to configure catch all on your mail server.

What id catchall ?

Mail server provide facility like catchall which will handle all mail with domain means here i try to explain with example that may
be useful to you :

Ex. Company domain name :
now someone send a mail to now there is no any xxx mail address defined in the so these kind of mails are
handled under catchall.

Now, in openerp server you have to define both address one is original and second one catchall which will fetch-out all mail.

Why its needed ?

Because whenever we create any project or etc than there is automatically created alias.

Suppose we created new project user alias set as
user add followers and send a notification so there is set sender name, receiver a valid mail id, and in reply to there is project alias set.

So, if a customer reply to that mail than he face the problem as undelivered mail if there is no any catchall defined.

Now, if we defined catchall than the message will automatically fetched and appended to particular object.

We hope this information will helpful to you.


OpenERP Error

OpenERP error like : when we use new 'addons / web / server'

Solution :
Manual migration script to run on DB :

ALTER TABLE ir_model_fields ADD column serialization_field_id int references ir_model_fields on delete cascade;

Server Traceback (most recent call last):
  File "/home/pna/workspace/6.1/web/addons/web/common/", line 593, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/home/pna/workspace/6.1/server/openerp/", line 360, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/home/pna/workspace/6.1/server/openerp/service/", line 397, in dispatch
    return fn(*params)
  File "/home/pna/workspace/6.1/server/openerp/service/", line 408, in exp_authenticate
    res_users = pooler.get_pool(db).get('res.users')
  File "/home/pna/workspace/6.1/server/openerp/", line 50, in get_pool
    return get_db_and_pool(db_name, force_demo, status, update_module)[1]
  File "/home/pna/workspace/6.1/server/openerp/", line 33, in get_db_and_pool
    registry = RegistryManager.get(db_name, force_demo, status, update_module, pooljobs)
  File "/home/pna/workspace/6.1/server/openerp/modules/", line 180, in get
    update_module, pooljobs)
  File "/home/pna/workspace/6.1/server/openerp/modules/", line 202, in new
    openerp.modules.load_modules(registry.db, force_demo, status, update_module)
  File "/home/pna/workspace/6.1/server/openerp/modules/", line 298, in load_modules
    loaded_modules, processed_modules = load_module_graph(cr, graph, status, perform_checks=(not update_module), report=report)
  File "/home/pna/workspace/6.1/server/openerp/modules/", line 167, in load_module_graph
    models = pool.load(cr, package)
  File "/home/pna/workspace/6.1/server/openerp/modules/", line 109, in load
    res.append(cls.create_instance(self, cr))
  File "/home/pna/workspace/6.1/server/openerp/osv/", line 919, in create_instance
    obj.__init__(pool, cr)
  File "/home/pna/workspace/6.1/server/openerp/osv/", line 1027, in __init__
    if field['serialization_field_id']:
KeyError: 'serialization_field_id'

Thursday, 6 June 2013

Field level Security in OpenERP

Field level Security in OpenERP

In openerp erp its some times its needed to secure system.

So, there are lots of way to secure System. You can create access rights, Groups or etc.

But i think some times needed to field level security also. So, we can simply groups= "xyz group" so it will simply manage and that particular user can access. You can also restrict from xml also.

But if you try same thing in 7 also than you find if in fields you put "group1" and now, if you login with other group user which have all access rights of current object and you have put another group on fields than it will give you access rights warning and not able to access whole object.

So, in that case you can achieve from following code.

'standard_price': fields.float('Cost', write=['base.group_sale_manager'], read=['base.group_user']),

Suppose, here i give you example of standard price in this i give read right to 'base.group_user' and for write rights give to sales manager so, now you can restrict it by only sales manager can update cost price and the rest of user can only see but not rights to update.

And for invisible particular field you can use groups in xml file also.
So, you can achieve field level security as well as xml security to hide.

<field name="standard_price" groups="base.group_sale_manager"/>

We hope it will useful to you.


Friday, 3 May 2013

Document Management System in OpenERP

Hello All,
Today i try to explore a Document Management System in OpenERP,
I think its very easy or some says there is nothing new in it.
Yes, you all are right if you already know about it otherewise
its became complex.
Here i try to explain DMS in OpenERP with FTP server.

I hope its useful to all of you.

Define Sale Tax as well as purchase tax in OpenERP 7

You can define Default sale tax as well as Purchase tax in openerp 7.
That will be set at the product when you create new product than it will automatically set default sale tax as well as purchase tax.


Monday, 15 April 2013

Example of xmlrpc and openerp

How to work with xmlrpc and OpenERP?

Here example of xmlrpc and openerp ....
save following file as

You can also create xmlrpc for the use of import or export data. Or you can also create a new records also.

Example : 
import xmlrpclib
username = 'admin'
password = 'a'
database = 'test_60A'
sock_comm = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/common')
uid = sock_comm.login(database,username,password)
sock = xmlrpclib.ServerProxy('http://localhost:8069/xmlrpc/object')
print "connection success full"
ids = sock.execute(database,uid, password,'', 'search', [])
print "list of ids",ids
#ids will contain ids of company A and B
sock.execute(database,uid, password, '', 'write', ids, {'rml_header1': 'hop'})

start server and run file $  python

With workflow(invoice validate) :
sock.exec_workflow (dbname, 1, pwd, 'account.invoice', 'invoice_open', inv_id)

Here a example of connect with server and fetch list of ids of company and just call write operation you can do
the operation which needed..


Wednesday, 10 April 2013

How to apply patch in OpenERP ?

How to apply patch in OpenERP ?

Hello All, I think most of all of you guys in search of "How to apply Patch? Or What is patch?", yes, if you are developer than you know but if you are not a developer than its creates problem about to patch.

Here i try to describe some of steps or trick to apply patch, how it will be helpful to you all.

What is patch ?

Simply, patch is piece of some bug(error) fixing or some improvements of existing system.In another way patch means you are using any software and there is any error or need to improve or something else you want to do with existing system than obisiously you are trying such a thing in temperory source and if its work fine than you have to change in main code

For Apply :

1. If you use Ubuntu (Mind blowing Open Source) than its easy to apply patch.
 From command prompt follow the command :

 Go to particular directory and just apply patch
    > patch -p1 < ~/Desktop/xxx.patch

Or if you are using the Eclipse

2. If you are using Eclipse than also its, became easy to apply patch.
For that right click on addons folder then click on "Team" and select apply patch you will get the wizard to apply the patch.


View Larger Map

Wednesday, 13 March 2013

Full Configuration of Warehouse in OpenERP

                                                                                                 Pinakin Nayi
                                                                                                 OpenERP, Gandhinagar, India.

Full Configuration of Warehouse system in OpenERP

Hello All,

 I hope you all are about to search "Full Configuration of Warehouse in specific OpenERP" , I just try to explain the steps which will may be helpful to you all to configure your system or make it suitable for warehousing. Enjoy its.

Here I have tried to explain certain steps that all are may be useful to you.

1. Create two warehouse user. (off1,off2)

2. Create warehouses (A and b) within same company

3. Set the responsible :
      - Off1 is responsible for warehouse A
      - Off2 is responsible for warehouse B

4. Create separate shops for warehouse :
      Shops (under Sales > Configuration > Sales > Shop):
                - Shop WH A (warehouse: Warehouse A)
                - Shop WH B (warehouse: Warehouse B)

5. Create Location separate for warehouse :
     - WH A (view location)
              -- Output (internal location; chained to Customer: Stock Journal WH A Delivery Orders)
              -- Stock (internal location)
     - WH B (view location)
              -- Output (internal location; chained to Customer: Stock Journal WH B Delivery Orders)
              -- Stock (internal location)

Stock Journals:
- WH A Delivery Orders (responsible: off1)
- WH B Delivery Orders (responsible: off2)

Tips : When you create sale order than set particular shop for proper output.

Shortly i update Warehouse Configuration with full video...

Sunday, 17 February 2013

Purchase Requisition with OpenERP 7

                                                                                                     Pinakin Nayi
                                                                                                     OpenERP, Gandhinagar, India.

"Purchase Requisition" Full flow in OpenERP.

Here are steps for "Purchase Requisition" in OpenERP 7.0.

1 ) Install Purchase Requisition

2 ) Create Product
           - Make sure product is Purchased
           - Tick on Purchase Requisition (Product > Procurement Tab)
           - Add Supplier for Product

3 ) Create Sale order (Go to Sales, select that product)

4 ) Confirm Sale order

5 ) Go To Warehouse > Schedulers > Procurement Exception See that procurement

6 ) Run Schedulers

7 ) Go To Procurement Exception see "Latest Requisition" is there.

8 ) go To purchase requisition  > Add quotation > Select any one from and confirm it

9 ) Go to Purchase order , you can see the purchase order

Here i have created video that may be useful to you all.

                                                 "Purchase Requisition"

Thursday, 3 January 2013

How to extend local storage ?

                                                                                                              Pinakin Nayi
                                                                                                              OpenERP , Gandhinagar.

How to extend local storage ?

Hello Friends ,

  If you all are using OpenERP POS than there may be you face error like this ,

Ok this error came from local storage , because in OpenERP 7 POS module ,

we load all information related to POS in local storage for fast access and offline work.

Offline Work :

Why this needed ?
             Normally, if our server not responded or may be there are some problem to receiving any answer from server than we have need all info to store in local Database, So OpenERP Support for that and whenever server up(before closing) than it will automatically store or synchronized all orders.
  If your data more than 5MB in POS than it will creates problem to you because most of browsers support 5MB local storage. 

But if you are using Firefox than here a solution that will provide you facility to exceed local storage.