Sunday, 10 September 2017

New in V11

Coming soon.. with detail...

Tuesday, 5 September 2017

How to use profile in Odoo ?

How to use profile in Odoo ?

If you want to know number of queries, calls and time of each method you can use @profile in Odoo.

You can simply use profile by importing profile

from import profile

after importing you can add it in any method. Suppose If I want to know the executing time of partner creation, I can simply write the following code in file,

    def create(self, vals):

Now, restart your server.

Here, I had added @profile on res.partner creation. So When I create contact(res.partner) in Odoo the system logs entries.

calls     queries   ms
res.partner ------------------------- /home/XYZ/workspace/master/odoo/addons/base/res/, 489

1         0         0.02          @api.model
                                  def create(self, vals):
1         0         0.01              if vals.get('website'):
                                          vals['website'] = self._clean_website(vals['website'])
1         0         0.01              if vals.get('parent_id'):
                                          vals['company_name'] = False
1         0         0.02              tools.image_resize_images(vals)
1         20        97.75             partner = super(Partner, self).create(vals)
1         2         5.21              partner._fields_sync(vals)
1         0         0.18              partner._handle_first_contact_creation()
1         0         0.01              return partner

1         22        103.19  

Here, total 103.19 milliseconds time taken to create new partner..

There are more parameter you can pass in profile.

all methods for all odoo models by applying the optional filters.

1. param whitelist: None or list of model names to display in the log        
    ex.  @profile(whitelist=['sale.order', ''])

2. param files: None or list of filenames to display in the log
    ex. @profile(files=['/home/openerp/odoo/odoo/addons/sale/models/'])

3. param list blacklist: list model names to remove from the log

4. param int minimum_time: minimum time (ms) to display a method
5. param int minimum_queries: minimum sql queries to display a method


Tuesday, 27 June 2017

How to import products with their initial inventory ?

In some cases we need to import products with their inventory. 

There are several ways to do this,

- We can do manually by adding products and their qty
- for each product and its qty create stock moves either manually or import CSV
- or any complex way

The easiest way to do this, is import inventory adjustment through Odoo import functionality.

Here are some steps :

- First create test inventory adjustment,
- add few products and then export that inventory adjustment(just for export template purpose).
- Just cancel/delete that inventory adjustment.

Now, in exported csv you can add your products(database ids) and qty.

That's it ,

After adding your inventory products in CSV, you can import that CSV in Odoo.

Note : At the time of validate CSV if you got any error related to products, then just select product database Id from list.

Here attached sample csv which you can import easily, => Click Here

Video :


Use of different location type in Odoo

Vendor Location: Virtual location representing the source location for products coming from your vendors

- This is the locaction you can set on your vendor, may this will be generic or supplier specific.
- This location will be considered when you are purchase something, in your incoming recipt "Source Location Zone".

View: Virtual location used to create a hierarchical structures for your warehouse, aggregating its child locations ; can't directly contain products

Internal Location: Physical locations inside your own warehouses,

- They can be the loading and unloading area of your warehouse, a shelf or a department, etc.

Customer Location: Virtual location representing the destination location for products sent to your customers

Inventory Loss: Virtual location serving as counterpart for inventory operations used to correct stock levels (Physical inventories)

Procurement: Virtual location serving as temporary counterpart for procurement operations when the source (vendor or production) is not known yet. This location should be empty when the procurement scheduler has finished running.

Production: Virtual counterpart location for production operations: this location consumes the raw material and produces finished products

Transit Location: Counterpart location that should be used in inter-companies or inter-warehouses operations

The Virtual Locations are places that do not exist, but in which products can be placed when they are not physically in an inventory yet (or anymore). They come in handy when you want to place lost products out of your stock (in the Inventory loss), or when you want to take into account products that are on their way to your warehouse (Procurements).
(source from : odoo)