View 向Odoo中的树视图添加更多字段
我需要显示View 向Odoo中的树视图添加更多字段,view,tree,odoo,View,Tree,Odoo,我需要显示账户.move的相关模型的一些附加字段,如日记帐id.code 我不知道怎么做。这里的一些答案和Odoo的论坛(,)建议使用计算字段。阅读ORM文档时,我继承了模型account.move,并添加了带有相关属性的字段,但在打开视图时显示错误 class new_account_move(models.Model): _inherit = 'account.move' partner_name = fields.Char(related='partner_id.name
账户.move
的相关模型的一些附加字段,如日记帐id.code
我不知道怎么做。这里的一些答案和Odoo的论坛(,)建议使用计算字段。阅读ORM文档时,我继承了模型account.move
,并添加了带有相关属性的字段,但在打开视图时显示错误
class new_account_move(models.Model):
_inherit = 'account.move'
partner_name = fields.Char(related='partner_id.name', store=True)
journal_code = fields.Char(related='journal_id.code', store=True)
浏览器控制台中出现错误:
Uncaught (in promise) Error: Unknown field state in domain
compute http://localhost:8069/web/static/src/js/core/domain.js:68
evalModifier http://localhost:8069/web/static/src/js/views/basic/basic_model.js:2220
_evalModifiers http://localhost:8069/web/static/src/js/views/basic/basic_model.js:2229
_registerModifiers http://localhost:8069/web/static/src/js/views/basic/basic_renderer.js:553
_renderBodyCell http://localhost:8069/web/static/src/js/views/list/list_renderer.js:423
cells http://localhost:8069/web/static/src/js/views/list/list_renderer.js:838
_renderRow http://localhost:8069/web/static/src/js/views/list/list_renderer.js:837
_renderRow http://localhost:8069/web/static/src/js/views/list/list_editable_renderer.js:1164
OdooClass.extend/Class.include/</prototype[name]</< http://localhost:8069/web/static/src/js/core/class.js:123
_renderRows http://localhost:8069/web/static/src/js/views/list/list_renderer.js:858
_renderRows http://localhost:8069/web/static/src/js/views/list/list_editable_renderer.js:1185
OdooClass.extend/Class.include/</prototype[name]</< http://localhost:8069/web/static/src/js/core/class.js:123
_renderBody http://localhost:8069/web/static/src/js/views/list/list_renderer.js:375
_renderBody http://localhost:8069/web/static/src/js/views/list/list_editable_renderer.js:1090
OdooClass.extend/Class.include/</prototype[name]</< http://localhost:8069/web/static/src/js/core/class.js:123
_renderView http://localhost:8069/web/static/src/js/views/list/list_renderer.js:971
OdooClass.extend/</prototype[name]</< http://localhost:8069/web/static/src/js/core/class.js:90
_renderView http://localhost:8069/web/static/src/js/views/list/list_editable_renderer.js:1220
OdooClass.extend/Class.include/</prototype[name]</< http://localhost:8069/web/static/src/js/core/class.js:123
_render http://localhost:8069/web/static/src/js/views/basic/basic_renderer.js:592
_render http://localhost:8069/web/static/src/js/views/list/list_editable_renderer.js:1053
OdooClass.extend/Class.include/</prototype[name]</< http://localhost:8069/web/static/src/js/core/class.js:133
start http://localhost:8069/web/static/src/js/views/abstract_renderer.js:37
OdooClass.extend/</prototype[name]</< http://localhost:8069/web/static/src/js/core/class.js:90
start http://localhost:8069/web/static/src/js/views/list/list_editable_renderer.js:115
OdooClass.extend/Class.include/</prototype[name]</< http://localhost:8069/web/static/src/js/core/class.js:133
_widgetRenderAndInsert http://localhost:8069/web/static/src/js/core/widget.js:433
promise callback*_widgetRenderAndInsert http://localhost:8069/web/static/src/js/core/widget.js:427
appendTo http://localhost:8069/web/static/src/js/core/widget.js:193
_startRenderer http://localhost:8069/web/static/src/js/views/abstract_controller.js:456
start http://localhost:8069/web/static/src/js/core/mvc.js:124
OdooClass.extend/</prototype[name]</< http://localhost:8069/web/static/src/js/core/class.js:90
start http://localhost:8069/web/static/src/js/views/abstract_controller.js:84
OdooClass.extend/</prototype[name]</< http://localhost:8069/web/static/src/js/core/class.js:90
start http://localhost:8069/web/static/src/js/views/basic/basic_controller.js:59
OdooClass.extend/</prototype[name]</< http://localhost:8069/web/static/src/js/core/class.js:90
_widgetRenderAndInsert http://localhost:8069/web/static/src/js/core/widget.js:433
promise callback*_widgetRenderAndInsert http://localhost:8069/web/static/src/js/core/widget.js:427
appendTo http://localhost:8069/web/static/src/js/core/widget.js:193
_startController http://localhost:8069/web/static/src/js/chrome/action_manager.js:853
_executeAction http://localhost:8069/web/static/src/js/chrome/action_manager.js:314
promise callback*_executeAction http://localhost:8069/web/static/src/js/chrome/action_manager.js:313
_executeWindowAction http://localhost:8069/web/static/src/js/chrome/action_manager_act_window.js:314
promise callback*_executeWindowAction/< http://localhost:8069/web/static/src/js/chrome/action_manager_act_window.js:312
promise callback*_executeWindowAction http://localhost:8069/web/static/src/js/chrome/action_manager_act_window.js:257
_handleAction http://localhost:8069/web/static/src/js/chrome/action_manager_act_window.js:402
OdooClass.extend/Class.include/</prototype[name]</< http://localhost:8069/web/static/src/js/core/class.js:123
_handleAction http://localhost:8069/web/static/src/js/chrome/action_manager_report.js:164
OdooClass.extend/Class.include/</prototype[name]</< http://localhost:8069/web/static/src/js/core/class.js:123
doAction http://localhost:8069/web/static/src/js/chrome/action_manager.js:165
promise callback*doAction http://localhost:8069/web/static/src/js/chrome/action_manager.js:157
do_action http://localhost:8069/web/static/src/js/chrome/abstract_web_client.js:273
_openMenu http://localhost:8069/web/static/src/js/chrome/web_client.js:239
completed http://localhost:8069/web/static/src/js/chrome/web_client.js:215
on_menu_clicked http://localhost:8069/web/static/src/js/chrome/web_client.js:214
lock http://localhost:8069/web/static/src/js/core/concurrency.js:195
promise callback*exec/this.lock< http://localhost:8069/web/static/src/js/core/concurrency.js:194
exec http://localhost:8069/web/static/src/js/core/concurrency.js:193
on_menu_clicked http://localhost:8069/web/static/src/js/chrome/web_client.js:213
promise callback*on_menu_clicked http://localhost:8069/web/static/src/js/chrome/web_client.js:210
proxy http://localhost:8069/web/static/src/js/core/mixins.js:277
trigger http://localhost:8069/web/static/src/js/core/mixins.js:224
_trigger_up http://localhost:8069/web/static/src/js/core/mixins.js:339
_trigger_up http://localhost:8069/web/static/src/js/core/mixins.js:341
trigger_up http://localhost:8069/web/static/src/js/core/mixins.js:334
_trigger_menu_clicked http://localhost:8069/web/static/src/js/chrome/menu.js:112
_on_secondary_menu_click http://localhost:8069/web/static/src/js/chrome/menu.js:139
on_secondary_menu_click http://localhost:8069/web/static/src/js/chrome/menu.js:55
jQuery 8
start http://localhost:8069/web/static/src/js/chrome/menu.js:62
OdooClass.extend/</prototype[name]</< http://localhost:8069/web/static/src/js/core/class.js:90
_widgetRenderAndInsert http://localhost:8069/web/static/src/js/core/widget.js:433
promise callback*_widgetRenderAndInsert http://localhost:8069/web/static/src/js/core/widget.js:427
prependTo http://localhost:8069/web/static/src/js/core/widget.js:267
instanciate_menu_widgets http://localhost:8069/web/static/src/js/chrome/web_client.js:122
promise callback*instanciate_menu_widgets http://localhost:8069/web/static/src/js/chrome/web_client.js:112
show_application http://localhost:8069/web/static/src/js/chrome/web_client.js:81
start http://localhost:8069/web/static/src/js/chrome/abstract_web_client.js:147
domain.js:68:23
未捕获(承诺中)错误:域中的字段状态未知
计算http://localhost:8069/web/static/src/js/core/domain.js:68
蒸发改进剂http://localhost:8069/web/static/src/js/views/basic/basic_model.js:2220
_评估修改器http://localhost:8069/web/static/src/js/views/basic/basic_model.js:2229
_注册表修改器http://localhost:8069/web/static/src/js/views/basic/basic_renderer.js:553
_renderBodyCellhttp://localhost:8069/web/static/src/js/views/list/list_renderer.js:423
细胞http://localhost:8069/web/static/src/js/views/list/list_renderer.js:838
_伦德罗http://localhost:8069/web/static/src/js/views/list/list_renderer.js:837
_伦德罗http://localhost:8069/web/static/src/js/views/list/list_editable_renderer.js:1164
OdooClass.extend/Class.include/我修复了添加错误在我的树中指定的字段的错误
在我的例子中,错误是错误:域中的未知字段状态
。所以,我只需要将state
字段添加到我的树状视图中
<field name="state"/>
就这些
注意:添加optional=“hidde”
或invisible
属性以在树视图中隐藏字段。我修复了添加错误在我的树中指定的字段时出现的错误
<field name="state"/>
在我的例子中,错误是错误:域中的未知字段状态
。所以,我只需要将state
字段添加到我的树状视图中
<field name="state"/>
就这些
注意:添加optional=“hidde”
或invisible
属性以隐藏树状视图中的字段。错误是什么?哦,从记录id
中删除ayphuteclocalization.
(您的模块名称?)。您应该关闭发票日期
字段标记。很抱歉,这是一个复制粘贴错误。我刚刚编辑了问题,修复了它并添加了错误。尝试在chrome控制台中查看实际错误,最好使用资产激活开发者模式。错误是什么?哦,从记录id
中删除Ayphutecolocalization.
(您的模块名称?)。您应该关闭发票日期
字段标记。对不起,这是一个复制粘贴错误。我刚刚编辑了这个问题,修复了它并添加了错误。试着在chrome控制台中查看实际的错误,最好使用资产激活开发者模式
<field name="state"/>