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

请给我解决方案

python代码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."),
    }

最佳答案

不再使用_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.'
)

关于python - 如何将odoo8字段转换为odoo11,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50522619/

10-14 19:10