如何在操作菜单Odoo 12中添加新按钮?

问题描述

我试图在名为“ consultation”的模型中的动作内添加一个按钮,单击该按钮后,我需要打开我创建的向导,但是我陷入了一些错误



<?xml version="1.0" encoding="utf-8"?>
<odoo>
     <record id="specialist_no_show" model="ir.ui.view">
         <field name="name">specialist no show</field>
         <field name="model">specialist.no.show</field>
         <field name="arch" type="xml">
            <form string="No Show">
                <group>
                    <group>
                        <field name="partner_id"  readonly="1"/>
                    </group>
                </group>
                <footer>
                    <button name="update_no_show" string="Confirm" type="object" class="btn-primary"/>
                    <button string="Cancel" class="btn-secondary" special="cancel"/>
                </footer>
            </form>
         </field>
     </record>
    <act_window name="No Show"
            id="specialist_no_show"
            res_model="specialist_no_show" #model created for the wizard
            binding_model="consultation"   #model where i want to show the button in the action
            binding_views="form" 
            view_mode="list"
            target="new"
        />
</odoo>

解决方法

我可以发现一些可以尝试的问题:

  • Row (){ Column( modifier = Modifier.align(Alignment.CenterVertically)){ Text(text = "Centered ",style = textStyle) } Column { Text(text = "Line One ",style = textStyle) Text(text = "Line Two ",style = textStyle) } } form的XML ID必须不同。在您的示例中,两者都是act_window
  • specialist_no_show必须为res_model
  • specialist.no.show的结构因您的Odoo版本而异(请参见下文)。

对于Odoo 12.0版

act_window

对于Odoo版本13.0

<act_window name="No Show"
        id="action_specialist_no_show"
        res_model="specialist.no.show"
        src_model="consultation"
        view_mode="form"
        target="new"
    />

此外,如@Kenly所建议,错误日志将很有帮助。总是张贴那些。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...