自定义odoo 12仪表板

时间:2019-12-05 06:08:22

标签: forms odoo dashboard

我要创建仪表板,以便显示表单视图。仪表板的代码如下:

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- Action for survey-->
<record model="ir.actions.act_window" id="survey_create_action">
<field name="name">survey.create</field>
<field name="res_model">survey.survey</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="survey.survey_form"/>

</record>


<!-- board form view -->
<record model="ir.ui.view" id="board_form" >
<field name="name">Surveys</field>
<field name="model">board.board</field>
<field name="arch" type="xml">
<form string="survey_page_questions">
<h1>Survey</h1>
<hpaned>
<child1>
<action string="Survey" name="%(survey_create_action)d"/>
<button type="action" name="%(survey.survey_form)d"/>
</child1>
</hpaned>
</form>
</field>
</record>

<record model="ir.actions.act_window" id="board_action">
<field name="name">survey.action</field>
<field name="res_model">board.board</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="usage">menu</field>
<field name="view_id" ref="board_form"/>
</record>

<menuitem id="survey_menu" name="Survey" />
<menuitem id="survey_menu_form" name="survey" parent="survey_menu" action="board_action"/>

</odoo>

加载测量菜单后,将不会显示任何内容。在单击要显示表单视图的按钮后,我也在仪表板上创建了按钮,但是它给了我以下错误:

  

文件“ /usr/local/sampada/survey-workspace/spn/odoo/models.py”,行   2780,读中       self._read_from_database(存储,继承)文件“ /usr/local/sampada/survey-workspace/spn/odoo/models.py”,第2959行,   在_read_from_database中       forbidden = missing.exists()文件“ /usr/local/sampada/survey-workspace/spn/odoo/models.py”,第4319行,   存在       self._cr.execute(query,[tuple(ids)])文件“ /usr/local/sampada/survey-workspace/spn/odoo/sql_db.py”,第148行,在   包装纸       返回f(self,* args,** kwargs)文件“ /usr/local/sampada/survey-workspace/spn/odoo/sql_db.py”,行225,在   执行       res = self._obj.execute(query,params)psycopg2.ProgrammingError:关系“ board_board”不存在第1行:SELECT id FROM   “ board_board” ID为IN的ID(假)                          ^

为什么会这样?任何帮助表示赞赏。谢谢

1 个答案:

答案 0 :(得分:0)

relation "board_board" does not exist

此错误意味着board_board表在数据库中不可用。无论何时安装模块,都将安装在该模块中定义的模型在数据库中创建相应的表,在这种情况下,对于board.board模型,board_board表必须存在。找不到该表可能是由以下原因之一引起的:

  

=>模块未正确安装,请安装/重新安装/升级

     

=> models/__init__.py文件未导入定义模型定义的xxx.py文件

导入模块后,检查Debug => Settings => Technical => Models列表并搜索您的特定型号是否列出。