Saturday, 14 June 2014

Show your Customers on google map in openerp ( Odoo Google Map Integration)

In this blog , I will show you ,how to show markers on google map for your Customers with their Details
I wanted to show filtered customers only . Example all customers for a particular City

Wednesday, 4 June 2014

Openerp 7 Linkedin integration ( Odoo )

This tutorial will dictate steps , how to integrate linkedin with openerp.

1. First you should have a linkedin Account .
   install Linkedin Integration Module(web_linkedin) and OAuth2 Authentication module
   now go to https://www.linkedin.com/secure/developer
 
2. create an application . I am attaching demo snapshots for that. 
   In snapshots ,I am using my local ip ie. http://192.168.1.50:8069/ instead of localhost:8069/
   Replace your ip in place of demo ip(192.168.1.50).
  



Fill the details as mentioned and give rights and then save your application . It will generate api and secret key.
   Note that api key.

3. Now in openerp , go to setting>sales>Social Network Integration
   check the "Get contacts automatically from linkedIn" checkbox
   and enter Api Key over there



4. now go to the customers -> edit view
   enter customer name and click on linkedin widget (blue icon). It will open a wizard , where related people and companies for that customer are shown.


5. If you find a usable search result , click on that results and address , email , phone , mobile , website etc are fetched from linked and filled automatically on the customer form


Thanks
Sonu Chaudhary



Tuesday, 3 June 2014

How to add new field in Delivery Orders or in shipments

I sufferd from this problem. I was trying to add new field in Delivery Order ,but it was disappearing from the view.
  So I thought to share it with you guys.
To add new field in Delivery Orders ex-'delivery_tracking' -
   inherit stock.picking.out and normal stock.picking with both having the fields.
Means you need to add your custom field in both stock.picking and stock.picking.out.

class stock_picking(osv.osv):
    _inherit = "stock.picking"
    _columns={
            'delivery_tracking': fields.char('Delivery Tracking' , size=32), # Your custom field

            }

class stock_picking_out(osv.osv):
    _inherit = "stock.picking.out"
    _columns={
            'delivery_tracking': fields.char('Delivery Tracking' , size=32), # Your custom field

            }
           

Now in xml, inherit Delivery view and add your custom field

<record id="view_stock_picking_out_extended" model="ir.ui.view">
    <field name="name">stock.picking.out.extended.form</field>
    <field name="model">stock.picking.out</field>
    <field name="inherit_id" ref="stock.view_picking_out_form"/>
    <field name="arch" type="xml">
            <field name="backorder_id" position="after">
                <field name="delivery_tracking" ><!-- Your custom field -->
            </field>
    </field>
</record>

The same applies for shipment view

Thanks
Sonu Chaudhary

Add Date range in Group by search filters in Openerp 7 ( Odoo )

Example -  You want to add this filter in tasks.
       In project.task object there are 2 fields - date_start and date_end , and we can use these fields for our date range filter

To add date from and date to filter in openerp , you can follow these steps:

1. import these packages in py file

import netsvc
from osv import fields, osv
from tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT, DATETIME_FORMATS_MAP, float_compare

2. inherit project_task class and add two fields - task_date_from and task_date_to, to be used for filter -
    class project_task(osv.osv):
        _inherit = "project.task"

        _columns = {
            'task_date_from':fields.function(lambda *a,**k:{}, method=True, type='date',string="Task date from"),
            'task_date_to':fields.function(lambda *a,**k:{}, method=True, type='date',string="Task date to"),

        }

3. Now add task_date_from and task_date_to fields in the view -
   For more interactive search view , you can use widget="calendar"

    <record id="view_task_search_form_inherit" model="ir.ui.view">
            <field name="name">project.task.search</field>
            <field name="model">project.task</field>
            <field name="inherit_id" ref="project.view_task_search_form" />
            <field name="arch" type="xml">
                <xpath expr="/search[@string='Tasks']/field[@name='project_id]" position="after">
                    <field name="task_date_from" filter_domain="[('date_start','&gt;=',self)]" widget="calendar"/>
                    <field name="task_date_to" filter_domain="[('date_end','&lt;=',self)]" widget="calendar"/>
                </xpath>
                
            </field>
        </record>



Thanks 
Sonu Chaudhary