Odoo Help

2

how to return a value from default_get method [Closed]

By
gpkarthick
on 5/9/13, 9:48 AM 3,699 views

The Question has been closed

by
Sudhir Arya (ERP Harbor Consulting Services)
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.fetchone()
    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

1

Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
11456
| 6 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 

LinkedIn

Blog

Stackoverflow

Sudhir Arya
ERP Harbor Consulting Services
skype: 
sudhir@erpharbor.com 
Sudhir Arya (ERP Harbor Consulting Services)
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 platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)

Stats

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