我尝试构建一个基本的 Odoo 15 模块,但在继承时出现错误

问题描述 投票:0回答:1

我正在尝试创建一个图形报告模块,但在继承时出现错误。 我从继承 crm 模块开始进行管理。 我的模块是:

class XPFReporting(models.Model):
    """
    This is the reporting system that will take all data from crm to further filter and order it
    """
    _name = 'xpf.reporting'
    _description = "XPF Reporting"
    _inherit = 'crm.lead'

    custom_field = fields.Char(string='Custom Field')

以及我的观点:

<?xml version="1.0" encoding="utf-8" ?>
<odoo>
    <!-- View for model -->
    <record id="view_xpf_reporting_tree" model="ir.ui.view">
        <field name="name">xpf.reporting.tree</field>
        <field name="model">xpf.reporting</field>
        <field name="arch" type="xml">
            <tree string="default tree">
                <field name="custom_field"/>
                <!-- <field name="*" /> -->
            </tree>
        </field>
    </record>

    <!-- Define the button to generate PDF report -->
    <record id="view_xpf_reporting_form" model="ir.ui.view">
        <field name="name">xpf.reporting.form</field>
        <field name="model">xpf.reporting</field>
        <field name="arch" type="xml">
            <form>
                <field name="custom_field"/>
                <!--
                group - Place holder for filtering
                -->
                <footer>
                    <button string="Generate PDF Report" type="object" class="oe_highlight" icon="fa-file-pdf-o"
                            name="generate_pdf_report"/>
                </footer>
            </form>
        </field>
    </record>

    <record id="action_xpf_reporting" model="ir.actions.act_window">
        <field name="name">XPF Reporting</field>
        <field name="res_model">xpf.reporting</field>
        <field name="view_mode">tree,form</field>
    </record>

    <menuitem id="menu_xpf_reporting" name="XPF Reporting" action="action_xpf_reporting" parent="" sequence="1"/>

</odoo>

问题是当我尝试安装它时返回:

TypeError: Many2many fields xpf.reporting.tag_ids and crm.lead.tag_ids use the same table and columns

任何想法都会受到赞赏。 谢谢

python xml module odoo odoo-15
1个回答
0
投票

再次阅读文档后。对于标准模型继承(和数据库表),您不需要定义

_name
字段,因为它使用原始名称!

© www.soinside.com 2019 - 2024. All rights reserved.