Odoo 模型";型号“U名称”;已声明,但在向模块添加新字段时无法加载

Odoo 模型";型号“U名称”;已声明,但在向模块添加新字段时无法加载,odoo,odoo-12,Odoo,Odoo 12,我完全是新手,目前正在开发新模型的过程中解决问题 我从一个基本的模型定义开始(见下文): 那时一切都很好,我看到了默认属性和那些新属性(名称和目标类型) 当我尝试在那里添加新属性(goal_percent=fields.integer(string=“Percentage”))并在Odoo中检查我的模型时(在数据库下),那里没有显示任何内容(空),在日志中我看到: 2019-04-24 18:35:51,668 4373 INFO odoo odoo.modules.registry: modu

我完全是新手,目前正在开发新模型的过程中解决问题

我从一个基本的模型定义开始(见下文):

那时一切都很好,我看到了默认属性和那些新属性(名称和目标类型)

当我尝试在那里添加新属性(goal_percent=fields.integer(string=“Percentage”))并在Odoo中检查我的模型时(在数据库下),那里没有显示任何内容(空),在日志中我看到:

2019-04-24 18:35:51,668 4373 INFO odoo odoo.modules.registry: module employee_goals: creating or updating database tables
2019-04-24 18:35:51,702 4373 INFO odoo odoo.modules.loading: loading employee_goals/views/views.xml
2019-04-24 18:35:51,704 4373 INFO odoo odoo.modules.loading: loading employee_goals/views/templates.xml
2019-04-24 18:35:51,705 4373 INFO odoo odoo.modules.loading: Module employee_goals: loading demo
2019-04-24 18:35:51,705 4373 INFO odoo odoo.modules.loading: loading employee_goals/demo/demo.xml
2019-04-24 18:35:51,756 4373 INFO odoo odoo.modules.loading: 31 modules loaded in 0.12s, 0 queries
2019-04-24 18:35:51,886 4373 WARNING odoo odoo.modules.loading: Model employee.goals is declared but cannot be loaded! (Perhaps a module was partially removed or renamed)
如果我删除最后一个属性“目标百分比”,它将再次开始工作,并且我的属性也将显示在odoo中。所以我想可能是postgres本身的数据有问题吧?但问题是,它只是我模型的花瓶,数据库本身没有插入任何内容。目前刚刚定义了模型

当我试图更改字段名称时,似乎也出现了此问题。

请检查拼写

new_field=fields.Integer(string=”“,required=False,)

你有
(goal_percent=fields.integer(string=“Percentage”)

你拼错了整数。你拼错了整数,但应该是整数

乙二醇

目标百分比=字段.整数(string=“Percentage”)


这应该行得通。如果不行,用一个新的字段Char检查一下,看它是否不是有问题的整数(应该不是,但可以测试).eg fields.Char

插入新属性后,您需要升级模块。您升级了吗?是的,尝试了多次。它似乎不喜欢DB中的某些内容,正如我所说,在添加某些内容之前,我在该特定模块的“数据库模型”视图中看到了我的字段,但在添加新属性并升级之后,它显示为空。我我认为这是同样的问题:
2019-04-24 18:35:51,668 4373 INFO odoo odoo.modules.registry: module employee_goals: creating or updating database tables
2019-04-24 18:35:51,702 4373 INFO odoo odoo.modules.loading: loading employee_goals/views/views.xml
2019-04-24 18:35:51,704 4373 INFO odoo odoo.modules.loading: loading employee_goals/views/templates.xml
2019-04-24 18:35:51,705 4373 INFO odoo odoo.modules.loading: Module employee_goals: loading demo
2019-04-24 18:35:51,705 4373 INFO odoo odoo.modules.loading: loading employee_goals/demo/demo.xml
2019-04-24 18:35:51,756 4373 INFO odoo odoo.modules.loading: 31 modules loaded in 0.12s, 0 queries
2019-04-24 18:35:51,886 4373 WARNING odoo odoo.modules.loading: Model employee.goals is declared but cannot be loaded! (Perhaps a module was partially removed or renamed)