Odoo Help


3 Answers

Anil R. Kesariya (AKE)

--Anil R. Kesariya (AKE)--
| 8 6 10
Rajkot, الهند
--Anil R. Kesariya (AKE)--

Odoo Techno Functional Expert

* Engaged with odoo since May - 2012.

* Customise existing module or develop new module base on customer requirement.

* Played key developer role in many past and running projects.

* Expert in requirement gathering of business and transforming requirement into odoo platform.

* Major expertise in core modules, database, report development and theme development.

* Integration expert.

Linkedin  : https://in.linkedin.com/in/anil-kesariya-97b20a66

Anil R. Kesariya (AKE)
17‏/5‏/2016 3:01 ص

Hi Vijay,

Here you go!

- override the default_get method to achieve this.

 in dictionary you have to pass key as your field name for which you want to set default value, would your updated value for that field.

def default_get(self, cr, uid, ids, context=None):
    # Either prepare your dictionary here to update in result dictionary    
    result = super(class_name, self).default_get(cr, uid, ids, context=context) # or directly update your result dictionary with new fields value to be updatr    return result

def default_get(self, vals):
#update dictionary with default fields
    result = super(product_new_revision, self).default_get(vals)
#Update dictionary with default fields
    return result
eg. Update dictionary value in this format -> {'field_name': 'default value'}

Hope this will help.




Qutechs, Ahmed M.Elmubarak

--Qutechs, Ahmed M.Elmubarak--
--Qutechs, Ahmed M.Elmubarak--

Qutechs, Ahmed M.Elmubarak
17‏/5‏/2016 1:58 ص


You can use the default_get method it returns a dict mapping fields names with their default values.

You can also check an example here 

Hope this could help

Ask a Question
Keep Informed
1 follower(s)
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