Odoo Help


set default value dynamically

on 11/5/13, 7:01 PM 953 views

I'm doing following:

def default_get(self, cr, uid, fields, context=None):
    data = super(extended_projects, self).default_get(cr, uid, fields, context=context)
    data['test_field'] = context.get('test_field','default_value')
    return data

This works and sets the default values.

But I need to set it dynamically, specifically in the fields_view_get method (which I'm overriding as well).

if I do this (in fields_view_get):

    context['test_field'] = 'new_default_value'
    test_data = self.default_get(cr, uid, ['test_field'], context=context)

The new default value doesn't show for the field.

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.


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)


Asked: 11/5/13, 7:01 PM
Seen: 953 times
Last updated: 3/16/15, 8:10 AM