Thursday, 28 May 2015

How to set default value in Odoo ?

When User open a form view at that time default value display and than after save record it will display value based on our requirement.

Here is char type field example which will display a string before save record default and than it will show different string.

We will use function filed for that. This field will not take input from the user click that will only used for information purpose.

Here is code example:

def _default_get(self, cr, uid, context=None):
    print " This function called before new record create "
    res = 'bhavesh'
    return res     

def _set_value(self, cr, uid, ids, name, args, context=None):
    print " This function called at time of saving record and form view load "
    res = {}
    for i in self.browse(cr, uid, ids, context=context):
        res[] = 'odedra'
    return res

_columns = {
    'value': fields.function(_set_value, type='char', string='Value'),

_defaults = {
    'value': _default_get,

I hope you like this article. Share your views to improve content. Happy Learning !!! 

Error: Hash Sum mismatch in GitLab

Recently, I have faced following error during instillation of Gitlab in Ubuntu. odedra@odedra-Lenovo-Z50-70:~$ sudo apt-get install gitla...