【问题标题】:odoo wizard cant inherit the modelodoo 向导不能继承模型
【发布时间】:2021-12-26 08:20:01
【问题描述】:

我创建了一个这样的模型

class FoundCheque(models.TransientModel):
    _name = "found.cheque"


    date_Found = fields.Date(string='Found Date', default=fields.Date.context_today, required=True, translate=True)

及其观点

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
    <data>
        <record model="ir.ui.view" id="wizard_found_cheque">
            <field name="name">found.cheque.wizard</field>
            <field name="model">found.cheque</field>
            <field name="arch" type="xml">
                <form string="found Cheque">
                    <group>
                        <field name="date_found" style="width:40%%"/>
                    </group>
                    <footer>
                        <button name="found_cheque" string="Post" type="object" class="oe_highlight"/>
                        or <button string="Cancel" class="oe_link" special="cancel"/>
                    </footer>
                </form>
            </field>
        </record>
    </data>
</odoo>

但是当我在重启服务后尝试更新模块时 它只是说:

Field `date_found` does not exist

Error context:
View `found.cheque.wizard`
[view_id: 4100, xml_id: n/a, model: found.cheque, parent_id: n/a]
None" while parsing /opt/odoo/odoo11-custom-addons/cheque_management/views/found_cheque.xml:4, near
<record model="ir.ui.view" id="wizard_found_cheque">
            <field name="name">found.cheque.wizard</field>
            <field name="model">found.cheque</field>
            <field name="arch" type="xml">
                <form string="found Cheque">
                    <group>
                        <field name="date_found" style="width:40%%"/>
                    </group>
                    <footer>
                        <button name="found_cheque" string="Post" type="object" class="oe_highlight" confirm="آیا مطمئن هستید؟"/>
                        or <button string="Cancel" class="oe_link" special="cancel"/>
                    </footer>
                </form>
            </field>
        </record>

为了补充,我重启了几次服务

更多信息将根据要求添加

【问题讨论】:

    标签: view model odoo field


    【解决方案1】:

    您在 python 文件中的字段名称是 xml 中的 date_Found 和 date_found。两者是不同的。所以更改xml文件中的字段名称

    【讨论】:

    • 欢迎来到 SO!这与昨天的现有答案相同。除非您有新内容要添加,否则请不要发布答案。
    【解决方案2】:

    模型中定义的字段是“date_Found”,向导中定义的字段是“date_found”

    F

    【讨论】:

      猜你喜欢
      • 2018-07-14
      • 2020-11-04
      • 2019-10-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多