تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
4285 أدوات العرض

I want to add default value on database since I may want to edit records without using odoo

what should I put to give a default value on batabase?

الصورة الرمزية
إهمال

detail your question.

أفضل إجابة

yes can use use the default values for the fields,

if you want some small number of fields as default value means ,you can use

_default = {

 'your_field' : 'your_default_value'

}

example:

_default = {

 'name' : 'Andrew',

  'age' : 20

}

 

otherwise,if you want to diplay more values as default means ,you can use

default_get() method

 

الصورة الرمزية
إهمال
أفضل إجابة

write this code in .py file

_columns = {

     'gender' : fields.selection([('m','Male'),('f','Female')],'Gender')

}

_defaults = {

 'gender' : 'm'

}

الصورة الرمزية
إهمال