Odoo 8.0:如何 link 菜单项修正视图?如何link形成视图来修正树视图?
Odoo 8.0: How to link menu items to correct views? How to link form view to correct tree view?
基于,我在Odoo V8.0 中为一个模型制作了2 个不同的树视图。
这很好用。
但现在我还想为这两个树视图添加表单视图。
当我在 .xml 中添加表单视图时,一切都变得一团糟。我在 de .xml 中尝试了很多不同的命令,但我无法真正修复它。
当我刚刚从 .xml 中删除表单时,表单显示了模型的所有字段。我只想展示其中的一部分。
这是我的views.xml:
<openerp>
<data>
<record model="ir.ui.view" id="opc_instellingen_id">
<field name="name">opc_taginstellingen_tree</field>
<field name="model">opc_tags</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree>
<field name="tagnaam"/>
<field name="lezenschrijven"/>
<field name="logging"/>
<field name="unit"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="opc_instellingen_id">
<field name="name">opc_taginstellingen_form</field>
<field name="model">opc_tags</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="OPC Taginstellingen">
<group colspan="1" col="4">
<field name="tagnaam"/>
<field name="lezenschrijven"/>
<field name="logging"/>
<field name="unit"/>
</group>
</form>
</field>
</record>
<record model="ir.ui.view" id="opc_actuele_waarden_id">
<field name="name">opc_actuelewaardentags_tree</field>
<field name="model">opc_tags</field>
<field name="arch" type="xml">
<tree delete="false">
<field name="tagnaam" readonly="True"/>
<field name="tagwaarde"/>
<field name="tagkwaliteit" readonly="True"/>
<field name="melding" readonly="True"/>
<field name="schrijvennaaropc"/>
<field name="unit" readonly="True"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="opc_actuele_waarden_id">
<field name="name">opc_actuelewaardentags_form</field>
<field name="model">opc_tags</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="OPC Actuele waarden tags">
<group colspan="1" col="4">
<field name="tagnaam" readonly="True"/>
<field name="tagwaarde"/>
<field name="tagkwaliteit" readonly="True"/>
<field name="melding" readonly="True"/>
<field name="schrijvennaaropc"/>
<field name="unit" readonly="True"/>
</group>
</form>
</field>
</record>
<record id="action_taginstellingen" model="ir.actions.act_window">
<field name="name">OPC Taginstellingen</field>
<field name="res_model">opc_tags</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="opc_instellingen_id"/>
</record>
<record id="action_tagwaarden" model="ir.actions.act_window">
<field name="name">OPC Actuele waarden tags</field>
<field name="res_model">opc_tags</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="opc_actuele_waarden_id"/>
</record>
<menuitem id="Toplevel" name="OPC Instellingen"/>
<menuitem id="Submenu" parent="Toplevel" name="OPC Instellingen"/>
<menuitem action="action_taginstellingen" id="menu_taginstellingen_id" sequence="1" name="OPC Taginstellingen" parent="Submenu"/>
<menuitem action="action_tagwaarden" id="menu_tagwaarden_id" sequence="2" name="OPC Actuele waarden" parent="Submenu"/>
</data>
</openerp>
这个 .xml 的问题是:
当我在菜单中单击 "OPC Taginstellingen" 时,它显示的是表格 "opc_taginstellingen_form" 而不是树 "opc_taginstellingen_tree"。
当我在菜单中单击 "OPC Actuele waarden" 时,它显示的是表格 "opc_actuelewaardentags_form" 而不是树 "opc_actuelewaardentags_tree"。
当我在 front-end 中将视图从表单更改为列表时,它只显示标题 "Created by"。所以它根本不会去 "opc_taginstellingen_tree" "opc_actuelewaardentags_tree"。
应该如何:
单击菜单中的 "OPC Taginstellingen" 时:显示树 "opc_taginstellingen_tree"。单击按钮创建时 ==> 转到 "opc_taginstellingen_form"。
在菜单中单击 "OPC Actuele waarden" 时:显示树 "opc_actuelewaardentags_tree"。单击按钮创建时 ==> 转到 "opc_actuelewaardentags_form"。
OPC 标签设置
<record model="ir.ui.view" id="opc_instellingen_tree_id">
<field name="name">opc_taginstellingen_tree</field>
<field name="model">opc_tags</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree>
<field name="tagnaam"/>
<field name="lezenschrijven"/>
<field name="logging"/>
<field name="unit"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="opc_instellingen_form_id">
<field name="name">opc_taginstellingen_form</field>
<field name="model">opc_tags</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="OPC Taginstellingen">
<group colspan="1" col="4">
<field name="tagnaam"/>
<field name="lezenschrijven"/>
<field name="logging"/>
<field name="unit"/>
</group>
</form>
</field>
</record>
<record id="action_taginstellingen" model="ir.actions.act_window">
<field name="name">OPC Actuele waarden tags</field>
<field name="res_model">opc_tags</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<record id="action_taginstellingen_tree" model="ir.actions.act_window.view">
<field name="view_mode">tree</field>
<field name="view_id" ref="opc_instellingen_tree_id" />
<field name="act_window_id" ref="action_taginstellingen" />
</record>
<record id="action_taginstellingen_form" model="ir.actions.act_window.view">
<field name="view_mode">form</field>
<field name="view_id" ref="opc_instellingen_form_id" />
<field name="act_window_id" ref="action_taginstellingen" />
</record>
<menuitem action="action_taginstellingen" id="menu_taginstellingen_id" sequence="1" name="OPC Taginstellingen" parent="Submenu"/>
OPC 实际值
<record model="ir.ui.view" id="opc_tagwaarden_tree_id">
<field name="name">opc_actuelewaardentags_tree</field>
<field name="model">opc_tags</field>
<field name="arch" type="xml">
<tree delete="false">
<field name="tagnaam" readonly="True"/>
<field name="tagwaarde"/>
<field name="tagkwaliteit" readonly="True"/>
<field name="melding" readonly="True"/>
<field name="schrijvennaaropc"/>
<field name="unit" readonly="True"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="opc_tagwaarden_form_id">
<field name="name">opc_actuelewaardentags_form</field>
<field name="model">opc_tags</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="OPC Actuele waarden tags">
<group colspan="1" col="4">
<field name="tagnaam" readonly="True"/>
<field name="tagwaarde"/>
<field name="tagkwaliteit" readonly="True"/>
<field name="melding" readonly="True"/>
<field name="schrijvennaaropc"/>
<field name="unit" readonly="True"/>
</group>
</form>
</field>
</record>
<record id="action_tagwaarden" model="ir.actions.act_window">
<field name="name">OPC Actuele waarden tags</field>
<field name="res_model">opc_tags</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<record id="action_tagwaarden_tree" model="ir.actions.act_window.view">
<field name="view_mode">tree</field>
<field name="view_id" ref="opc_tagwaarden_tree_id" />
<field name="act_window_id" ref="action_tagwaarden" />
</record>
<record id="action_tagwaarden_form" model="ir.actions.act_window.view">
<field name="view_mode">form</field>
<field name="view_id" ref="opc_tagwaarden_form_id" />
<field name="act_window_id" ref="action_tagwaarden" />
</record>
<menuitem action="action_tagwaarden" id="menu_tagwaarden_id" sequence="2" name="OPC Actuele waarden" parent="Submenu"/>
基于
但现在我还想为这两个树视图添加表单视图。 当我在 .xml 中添加表单视图时,一切都变得一团糟。我在 de .xml 中尝试了很多不同的命令,但我无法真正修复它。
当我刚刚从 .xml 中删除表单时,表单显示了模型的所有字段。我只想展示其中的一部分。
这是我的views.xml:
<openerp>
<data>
<record model="ir.ui.view" id="opc_instellingen_id">
<field name="name">opc_taginstellingen_tree</field>
<field name="model">opc_tags</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree>
<field name="tagnaam"/>
<field name="lezenschrijven"/>
<field name="logging"/>
<field name="unit"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="opc_instellingen_id">
<field name="name">opc_taginstellingen_form</field>
<field name="model">opc_tags</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="OPC Taginstellingen">
<group colspan="1" col="4">
<field name="tagnaam"/>
<field name="lezenschrijven"/>
<field name="logging"/>
<field name="unit"/>
</group>
</form>
</field>
</record>
<record model="ir.ui.view" id="opc_actuele_waarden_id">
<field name="name">opc_actuelewaardentags_tree</field>
<field name="model">opc_tags</field>
<field name="arch" type="xml">
<tree delete="false">
<field name="tagnaam" readonly="True"/>
<field name="tagwaarde"/>
<field name="tagkwaliteit" readonly="True"/>
<field name="melding" readonly="True"/>
<field name="schrijvennaaropc"/>
<field name="unit" readonly="True"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="opc_actuele_waarden_id">
<field name="name">opc_actuelewaardentags_form</field>
<field name="model">opc_tags</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="OPC Actuele waarden tags">
<group colspan="1" col="4">
<field name="tagnaam" readonly="True"/>
<field name="tagwaarde"/>
<field name="tagkwaliteit" readonly="True"/>
<field name="melding" readonly="True"/>
<field name="schrijvennaaropc"/>
<field name="unit" readonly="True"/>
</group>
</form>
</field>
</record>
<record id="action_taginstellingen" model="ir.actions.act_window">
<field name="name">OPC Taginstellingen</field>
<field name="res_model">opc_tags</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="opc_instellingen_id"/>
</record>
<record id="action_tagwaarden" model="ir.actions.act_window">
<field name="name">OPC Actuele waarden tags</field>
<field name="res_model">opc_tags</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="opc_actuele_waarden_id"/>
</record>
<menuitem id="Toplevel" name="OPC Instellingen"/>
<menuitem id="Submenu" parent="Toplevel" name="OPC Instellingen"/>
<menuitem action="action_taginstellingen" id="menu_taginstellingen_id" sequence="1" name="OPC Taginstellingen" parent="Submenu"/>
<menuitem action="action_tagwaarden" id="menu_tagwaarden_id" sequence="2" name="OPC Actuele waarden" parent="Submenu"/>
</data>
</openerp>
这个 .xml 的问题是:
当我在菜单中单击 "OPC Taginstellingen" 时,它显示的是表格 "opc_taginstellingen_form" 而不是树 "opc_taginstellingen_tree"。
当我在菜单中单击 "OPC Actuele waarden" 时,它显示的是表格 "opc_actuelewaardentags_form" 而不是树 "opc_actuelewaardentags_tree"。
当我在 front-end 中将视图从表单更改为列表时,它只显示标题 "Created by"。所以它根本不会去 "opc_taginstellingen_tree" "opc_actuelewaardentags_tree"。
应该如何:
单击菜单中的 "OPC Taginstellingen" 时:显示树 "opc_taginstellingen_tree"。单击按钮创建时 ==> 转到 "opc_taginstellingen_form"。
在菜单中单击 "OPC Actuele waarden" 时:显示树 "opc_actuelewaardentags_tree"。单击按钮创建时 ==> 转到 "opc_actuelewaardentags_form"。
OPC 标签设置
<record model="ir.ui.view" id="opc_instellingen_tree_id">
<field name="name">opc_taginstellingen_tree</field>
<field name="model">opc_tags</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree>
<field name="tagnaam"/>
<field name="lezenschrijven"/>
<field name="logging"/>
<field name="unit"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="opc_instellingen_form_id">
<field name="name">opc_taginstellingen_form</field>
<field name="model">opc_tags</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="OPC Taginstellingen">
<group colspan="1" col="4">
<field name="tagnaam"/>
<field name="lezenschrijven"/>
<field name="logging"/>
<field name="unit"/>
</group>
</form>
</field>
</record>
<record id="action_taginstellingen" model="ir.actions.act_window">
<field name="name">OPC Actuele waarden tags</field>
<field name="res_model">opc_tags</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<record id="action_taginstellingen_tree" model="ir.actions.act_window.view">
<field name="view_mode">tree</field>
<field name="view_id" ref="opc_instellingen_tree_id" />
<field name="act_window_id" ref="action_taginstellingen" />
</record>
<record id="action_taginstellingen_form" model="ir.actions.act_window.view">
<field name="view_mode">form</field>
<field name="view_id" ref="opc_instellingen_form_id" />
<field name="act_window_id" ref="action_taginstellingen" />
</record>
<menuitem action="action_taginstellingen" id="menu_taginstellingen_id" sequence="1" name="OPC Taginstellingen" parent="Submenu"/>
OPC 实际值
<record model="ir.ui.view" id="opc_tagwaarden_tree_id">
<field name="name">opc_actuelewaardentags_tree</field>
<field name="model">opc_tags</field>
<field name="arch" type="xml">
<tree delete="false">
<field name="tagnaam" readonly="True"/>
<field name="tagwaarde"/>
<field name="tagkwaliteit" readonly="True"/>
<field name="melding" readonly="True"/>
<field name="schrijvennaaropc"/>
<field name="unit" readonly="True"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="opc_tagwaarden_form_id">
<field name="name">opc_actuelewaardentags_form</field>
<field name="model">opc_tags</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="OPC Actuele waarden tags">
<group colspan="1" col="4">
<field name="tagnaam" readonly="True"/>
<field name="tagwaarde"/>
<field name="tagkwaliteit" readonly="True"/>
<field name="melding" readonly="True"/>
<field name="schrijvennaaropc"/>
<field name="unit" readonly="True"/>
</group>
</form>
</field>
</record>
<record id="action_tagwaarden" model="ir.actions.act_window">
<field name="name">OPC Actuele waarden tags</field>
<field name="res_model">opc_tags</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<record id="action_tagwaarden_tree" model="ir.actions.act_window.view">
<field name="view_mode">tree</field>
<field name="view_id" ref="opc_tagwaarden_tree_id" />
<field name="act_window_id" ref="action_tagwaarden" />
</record>
<record id="action_tagwaarden_form" model="ir.actions.act_window.view">
<field name="view_mode">form</field>
<field name="view_id" ref="opc_tagwaarden_form_id" />
<field name="act_window_id" ref="action_tagwaarden" />
</record>
<menuitem action="action_tagwaarden" id="menu_tagwaarden_id" sequence="2" name="OPC Actuele waarden" parent="Submenu"/>