Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


how to return a value from default_get method [Closed]

on 5/9/13, 9:48 AM 2,258 views

The Question has been closed

Sudhir Arya (SA)
on 05/19/2014 13:30:51
def default_get(self, cr, uid, fields, context=None):       
    fields = super(leadsales_target, self).default_get(cr, uid, fields, context=context)
    cr.execute('select name as "name" from sale_order')
    data = cr.dictfetchall()
    for rec in data:
        print rec,"44444444"
        fields['gpkchar'] = rec.get('name', '')             
        #res.update({'location_id': move.location_id.id})     
    print data,"2222222222"      
    return data

data value is [{'name': u'SO004'}, {'name': u'SO001'}, {'name': u'SO005'}, {'name': u'SO002'}, {'name': u'SO003'}] 22222222 how to return this data to my table the above method is working fine if i go to list view there is no data plz nayone help me


Sudhir Arya (SA)

--Sudhir Arya (SA)--
| 6 8 8
Ahmedabad, India
--Sudhir Arya (SA)--

Working as an OpenERP/Odoo developer and a Team Leader 

Top 5 Odoo contributor On Stackoverflow




Sudhir Arya (SA)
On 5/9/13, 11:21 AM

default_get method returns default values for the fields in fields_list. In this method you can assign desire value for the fields as defaults.

In you case you must return fields instead of data variable after changing it. You can only assign a single value to fields which will be displayed when you will open form view.

You can find more at default_get method.

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)


Asked: 5/9/13, 9:48 AM
Seen: 2258 times
Last updated: 3/16/15, 8:10 AM