我有一个代表 URL 书签的类
from openerp.osv import osv, fields
class jbbookmark_jbbookmark(osv.osv):
_name = "jbbookmark.jbbookmark"
_description = "Bookmark"
def default_get(self, cr, uid, fields, context=None):
res = super(jbbookmark_jbbookmark, self).default_get(cr, uid, fields, context=context)
res.update({'name': 'initial value test'})
res.update({'description': 'initial value test'})
return res
_columns = {
'name': fields.char('URL', required=True, translate=True),
'description': fields.text('Description'),
'title': fields.char('Name', size=20, required=True),
}
_defaults = {
'name':'test URL',
}
添加记录时,我尝试设置表单字段的初始值,但字段只是空白。我怎样才能让这些值显示在表单视图中