向模型添加字段时,升级的时候报这个错误,求解
-
跟着《Odoo14开发指南学习笔记》向模型添加字段时,升级的时候报这个错误!
求大佬指教,感谢。操作无法完成:
- 创建/更新: 未设置强制字段.
- 删除: 另一个模型要求删除记录。如果可能的话,把它存档。
模型: Fields (ir.model.fields), 字段: Field Type (ttype)
这是源代码
from odoo import models, fieldsclass LibraryBook(models.Model):
馆藏图书窗体 library.book
_name = 'library.book'
_description = '馆藏图书'
_order = 'date_release desc, name'
_rec_name = 'short_name'
name = fields.Char('书名',
required=True)
short_name = fields.Char('简称',
required=True, index=True)
notes = fields.Text('内部备注')
state = fields.Selection(
[('draft', '不可用'),
('available', '可用'),
('lost', '丢失')],
'状态',
default="draft")
description = fields.Html('描述', sanitize=True, strip_style=False)
cover = fields.Binary('图书封面')
out_of_print = fields.Boolean('已停印')
date_release = fields.Date('出版日期')
date_updated = fields.Datetime('最后更新时间')
pages = fields.Integer('页数',
groups='base,group_user',
states={'lost': [('readonly', True)]},
help='图书总页数',
company_dependent=False)
reader_rating = fields.Field(
'读者评分',
digits=(3, 1),
# 可选精度(全部位数, 小数位数),
)
# author_ids = fields.Many2many('res.partner', string='作者') -
跟着《Odoo14开发指南学习笔记》向模型添加字段时,升级的时候报这个错误!
求大佬指教,感谢。操作无法完成:
- 创建/更新: 未设置强制字段.
- 删除: 另一个模型要求删除记录。如果可能的话,把它存档。
模型: Fields (ir.model.fields), 字段: Field Type (ttype)
这是源代码
from odoo import models, fieldsclass LibraryBook(models.Model):
馆藏图书窗体 library.book
_name = 'library.book'
_description = '馆藏图书'
_order = 'date_release desc, name'
_rec_name = 'short_name'
name = fields.Char('书名',
required=True)
short_name = fields.Char('简称',
required=True, index=True)
notes = fields.Text('内部备注')
state = fields.Selection(
[('draft', '不可用'),
('available', '可用'),
('lost', '丢失')],
'状态',
default="draft")
description = fields.Html('描述', sanitize=True, strip_style=False)
cover = fields.Binary('图书封面')
out_of_print = fields.Boolean('已停印')
date_release = fields.Date('出版日期')
date_updated = fields.Datetime('最后更新时间')
pages = fields.Integer('页数',
groups='base,group_user',
states={'lost': [('readonly', True)]},
help='图书总页数',
company_dependent=False)
reader_rating = fields.Field(
'读者评分',
digits=(3, 1),
# 可选精度(全部位数, 小数位数),
)
# author_ids = fields.Many2many('res.partner', string='作者')This post is deleted!
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login