如何将odoo8字段转换为odoo11

时间:2018-05-25 06:13:13

标签: python odoo-10 odoo-11

如何将 odoo8 字段转换并迁移到 odoo11

请给我解决方案

python code odoo8:

_columns = {
        'name' : fields.char('Name', 64, required=True),
        'code' : fields.char('Code', 9, required=True),
        'description' : fields.text('Description'),
        'active': fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the record without removing it."),
    }

1 个答案:

答案 0 :(得分:2)

不再使用_columns,字段类型现在以大写字母开头。

name = fields.Char(
    string='Name',
    size=64,
    required=True,
)
code = fields.Char(
    string='Code',
    size=9,
    required=True
)
description = fields.Text(
    string='Description',
)
active = fields.Boolean(
    string='Active',
    help='If the active field is set to False, it will allow you to hide the '
         'record without removing it.'
)