gpt4 book ai didi

python - Odoo View 错误 : No default view of type ' form' could be found

转载 作者:行者123 更新时间:2023-12-02 02:51:17 28 4
gpt4 key购买 nike

当我点击按钮时,我应该会看到一个列表。还应该有创造新记录的能力。但是当我点击按钮时,我得到:

No default view of type ' form' could be found!

如何解决?

如果我从主菜单进入,就没有这个问题

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<act_window
id="attach_pdf_action"
name="Attach PDF"
res_model="attach.pdf" />

<menuitem
id="attach_pdf_menu"
name="Attach PDF"
action="attach_pdf_action"
parent=""
sequence="5" />

<record id="attach_pdf_view_form" model="ir.ui.view">
<field name="name">Attach PDF Form</field>
<field name="model">attach.pdf</field>
<field name="arch" type="xml">
<form>
<group>
<field name="product_id"/>
<field name="product_attribute_value_id"/>
</group>
<group>
<field name="file" widget="binary" filename="file_name" string="Binary"/>
</group>
</form>
</field>
</record>

<record id="attach_pdf_view_tree" model="ir.ui.view">
<field name="name">Attach PDF List</field>
<field name="model">attach.pdf</field>
<field name="arch" type="xml">
<tree>
<field name="product_id"/>
<field name="product_attribute_value_id"/>
<field name="file_name" readonly="1"/>
</tree>
</field>
</record>

<record id="attach_pdf_view_search" model="ir.ui.view">
<field name="name">Attach PDF Search</field>
<field name="model">attach.pdf</field>
<field name="arch" type="xml">
<search>
<field name="product_id"/>
<field name="product_attribute_value_id"/>
</search>
</field>
</record>

<record id="attach_file_wizard" model="ir.actions.act_window">
<field name="name">Attach PDF</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">attach.pdf</field>
<field name="view_type">form</field>
<field name="view_mode">tree, form</field>
<field name="domain" > [('product_id', '=', context.get('product_name'))]</field>
<field name="view_id" ref="attach_pdf_view_tree"/>
<field name="target">new</field>
</record>
<record id="view_form_product_attr_pdf" model="ir.ui.view">
<field name="name">attach_pdf_attribute_product_product_template_only_form_view</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//header/button[@name='121']" position="after">
<button name="%(attach_pdf_attribute.attach_file_wizard)d" context="{'product_name': name}" string="Attach PDF" type="action" class="oe_highlight"/>
</xpath>
</field>
</record>

</data>
</odoo>

最佳答案

您似乎在“view_mode”值中给出了空格。无需在值之间留出空间。

尝试使用以下代码:

<record id="attach_file_wizard" model="ir.actions.act_window">
<field name="name">Attach PDF</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">attach.pdf</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain" > [('product_id', '=', context.get('product_name'))]</field>
<field name="view_id" ref="attach_pdf_view_tree"/>
</record>

编辑:

删除 <field name="target">new</field>行。

文档:

comma-separated list of view types as a string (/!\ No spaces /!). All of these types will be present in the generated views list (with at least a False view_id)

关于python - Odoo View 错误 : No default view of type ' form' could be found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61934321/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com