向导窗体

来自Odoo大V社-odoo中文开发手册
1360857908讨论 | 贡献2017年5月28日 (日) 22:29的版本

跳转至: 导航搜索

向导窗体视图与普通模型是相同,除了两个特定的元素︰

 一个<footer>节点可以用于放置动作按钮  一种特殊type ="cancel"按钮可用于中断向导不执行任何操作

这是我们views/todo_wizard_view.xml文件的内容︰

<odoo>
    <record id="To-do Task Wizard" model="ir.ui.view">
        <field name="name">To-do Task Wizard</field>
        <field name="model">todo.wizard</field>
        <field name="arch" type="xml">
            <form>
                <div class="oe_right">
                    <button type="object" name="do_count_tasks"
                            string="Count"/>
                    <button type="object" name="do_populate_tasks"
                            string="Get All"/>
                </div>
                <field name="task_ids">
                    <tree>
                        <field name="name"/>
                        <field name="user_id"/>
                        <field name="date_deadline"/>
                    </tree>
                </field>
                <group>
                    <group>
                        <field name="new_user_id"/>
                    </group>
                    <group>
                        <field name="new_deadline"/>
                    </group>
                </group>
                <footer>
                    <button type="object" name="do_mass_update"
                            string="Mass Update" class="oe_highlight"
                            attrs="{'invisible':[('new_deadline','=',False),('new_user_id', '=',False)]}"/>
                    <button special="cancel" string="Cancel"/>
                </footer>
            </form>
        </field>
    </record>
    <!-- More button Action -->
    <act_window id="todo_app.action_todo_wizard"
                name="To-Do Tasks Wizard"
                src_model="todo.task" res_model="todo.wizard"
                view_mode="form" target="new" multi="True"/>
</odoo>
 

我们在 XML 中看到<act_window>窗口,通过使用src_model属性将选项添加到 To-do Taskp窗体的多个按钮。target ="new" 属性将打开一个对话框窗口。

你可能也注意到批量更新模块按钮使用attr,直到选择新的截止日期或负责任的用户选择更新后才能可见。