【发布时间】:2021-01-11 14:06:43
【问题描述】:
我需要显示account.move 相关模型的一些附加字段,例如journal_id.code。
我不知道该怎么做。这里的一些答案和 Odoo 的论坛(1、2)建议使用计算字段。阅读 ORM 文档,我继承了模型 acoount.move 并添加了具有 related 属性的字段,但在打开视图时显示错误。
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)
<record id="view_report_fourtenn_one_view" model="ir.ui.view">
<field name="name">reportfourtenone.tree</field>
<field name="model">account.move</field>
<field name="arch" type="xml">
<tree string="Report 14.01">
<field name="invoice_date"/>
<field name="amount_untaxed"/>
<field name="partner_name"/>
<field name="journal_sub_type"/>
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="view_report_fourtenn_one_tree">
<field name="name">Reporte 14.01</field>
<field name="res_model">account.move</field>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_report_fourtenn_one_view"/>
</record>
这种方法的错误是当我点击调用记录view_report_fourtenn_one_tree的menuitem。
Error:
Traceback:
compute@http://localhost:8069/web/content/727-9eea4b0/web.assets_backend.js:322:55
evalModifier@http://localhost:8069/web/content/727-9eea4b0/web.assets_backend.js:1200:91
_evalModifiers@http://localhost:8069/web/content/727-9eea4b0/web.assets_backend.js:1203:44
_registerModifiers@http://localhost:8069/web/content/727-9eea4b0/web.assets_backend.js:1404:101
_renderBodyCell@http://localhost:8069/web/content/727-9eea4b0/web.assets_backend.js:2089:70
_renderRow/$cells<@http://localhost:8069/web/content/727-9eea4b0/web.assets_backend.js:2113:117
_renderRow@http://localhost:8069/web/content/727-9eea4b0/web.assets_backend.js:2113:80
_renderRow@http://localhost:8069/web/content/727-9eea4b0/web.assets_backend.js:2023:69
OdooClass.extend/Class.include/</prototype[name]</<@http://localhost:8069/web/content/719-fee0a2c/web.assets_common.js:3864:371
_renderRows@http://localhost:8069/web/content/727-9eea4b0/web.assets_backend.js:2114:99
_renderRows@http://localhost:8069/web/content/727-9eea4b0/web.assets_backend.js:2024:53
OdooClass.extend/Class.include/</prototype[name]</<@http://localhost:8069/web/content/719-fee0a2c/web.assets_common.js:3864:371
_renderBody@http://localhost:8069/web/content/727-9eea4b0/web.assets_backend.js:2084:71
_renderBody@http://localhost:8069/web/content/727-9eea4b0/web.assets_backend.js:2018:76
OdooClass.extend/Class.include/</prototype[name]</<@http://localhost:8069/web/content/719-fee0a2c/web.assets_common.js:3864:371
_renderView@http://localhost:8069/web/content/727-9eea4b0/web.assets_backend.js:2117:575
OdooClass.extend/</prototype[name]</<@http://localhost:8069/web/content/719-fee0a2c/web.assets_common.js:3861:488
_renderView@http://localhost:8069/web/content/727-9eea4b0/web.assets_backend.js:2027:79
OdooClass.extend/Class.include/</prototype[name]</<@http://localhost:8069/web/content/719-fee0a2c/web.assets_common.js:3864:371
_render@http://localhost:8069/web/content/727-9eea4b0/web.assets_backend.js:1409:222
_render@http://localhost:8069/web/content/727-9eea4b0/web.assets_backend.js:2017:655
OdooClass.extend/Class.include/</prototype[name]</<@http://localhost:8069/web/content/719-fee0a2c/web.assets_common.js:3864:616
start@http://localhost:8069/web/content/727-9eea4b0/web.assets_backend.js:1079:26
OdooClass.extend/</prototype[name]</<@http://localhost:8069/web/content/719-fee0a2c/web.assets_common.js:3861:488
start@http://localhost:8069/web/content/727-9eea4b0/web.assets_backend.js:1984:405
OdooClass.extend/Class.include/</prototype[name]</<@http://localhost:8069/web/content/719-fee0a2c/web.assets_common.js:3864:616
_widgetRenderAndInsert/<@http://localhost:8069/web/content/719-fee0a2c/web.assets_common.js:4103:52
浏览器控制台出错:
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
注意:它在 docker 容器和 Firefox(隐身)上运行。
【问题讨论】:
-
错误是什么?
-
哦,然后从记录
id中删除ayphuteclocalization.(您的模块名称?)。 -
你应该关闭
invoice_date字段标签。 -
很抱歉,这是一个复制和粘贴错误。我刚刚编辑了修复它的问题并添加了错误。
-
尝试在chrome控制台查看实际错误,最好用资产激活开发者模式