Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/332.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 0值错误\u name属性report.test\u module.report\u test\u doc无效。[Qweb-Odoo]_Python_Report_Openerp_Qweb - Fatal编程技术网

Python 0值错误\u name属性report.test\u module.report\u test\u doc无效。[Qweb-Odoo]

Python 0值错误\u name属性report.test\u module.report\u test\u doc无效。[Qweb-Odoo],python,report,openerp,qweb,Python,Report,Openerp,Qweb,我试图使用报表解析器,但它总是弹出一个错误 ValueError The _name attribute report.test_module.report_test_doc is not valid 我搜索到您的报告名用于解析器模板和名称,以便由Odoo使用。如果我删除test_模块,它不会显示错误,但是hello()是不可调用的 report.xml <?xml version="1.0" encoding="utf-8"?> <openerp> <

我试图使用报表解析器,但它总是弹出一个错误

ValueError  The _name attribute report.test_module.report_test_doc is not valid
我搜索到您的报告名用于解析器模板和名称,以便由Odoo使用。如果我删除test_模块,它不会显示错误,但是hello()是不可调用的

report.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <report 
            id="eport_monthly_pdc"
            string="Monthly report of PDC"
            model="account.voucher"
            report_type="qweb-pdf"
            name="test_module.report_test_doc" 
            file="test_module.report_test_doc" 
        />
    </data>
</openerp>
<openerp>
<data> 
<template id="report_test_doc">
    <t t-call="report.html_container">
        <t t-foreach="docs" t-as="o">
            <t t-call="test_module.report_test_layout">
                <div class="page">
                    <div class="text-center">
                        <span t-esc="hello_world()"/>
                    </div>
                </div>
            </t>
        </t>
    </t>
</template>
</data>
</openerp>
报告测试文档.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <report 
            id="eport_monthly_pdc"
            string="Monthly report of PDC"
            model="account.voucher"
            report_type="qweb-pdf"
            name="test_module.report_test_doc" 
            file="test_module.report_test_doc" 
        />
    </data>
</openerp>
<openerp>
<data> 
<template id="report_test_doc">
    <t t-call="report.html_container">
        <t t-foreach="docs" t-as="o">
            <t t-call="test_module.report_test_layout">
                <div class="page">
                    <div class="text-center">
                        <span t-esc="hello_world()"/>
                    </div>
                </div>
            </t>
        </t>
    </t>
</template>
</data>
</openerp>

在您的情况下,基本上

Qweb report主要用于使用
模型调用。AbstractModel
为每个报表类型调用每个类条目的模型,并在类中继承它以用于解析器类条目

class report_parser_test(models.AbstractModel):
    _name = 'report.test_module.report_test_doc'
    _inherit = 'report.abstract_report'
    _template = 'test_module.report_test_doc'
    _wrapped_report_class = report_parser
每个Qweb报表解析器类条目的属性:

\u name属性,它总是以
报告开头。

\u inherit='report.abstract\u report' 它是report.abstract_report的默认继承,位于报表模块中(每个报表的基类)

\u模板='test\u module.report\u test\u doc'

基本上是

\u wrapped\u report\u class=report\u parser

它是解析器类条目的一部分,该条目包含报表逻辑和报表的计算逻辑

**还有一件事要调用hello()调用:

在您的例子中,您的函数是declare和added,您的报表解析器类很好,但我们必须在Qweb模板文件上调用该函数

喜欢

<span t-esc="hello()"/>

然后,您将从您的终端调用该函数


我希望我的回答能对你有所帮助:)

就你的情况而言,基本上

Qweb report主要用于使用
模型调用。AbstractModel
为每个报表类型调用每个类条目的模型,并在类中继承它以用于解析器类条目

class report_parser_test(models.AbstractModel):
    _name = 'report.test_module.report_test_doc'
    _inherit = 'report.abstract_report'
    _template = 'test_module.report_test_doc'
    _wrapped_report_class = report_parser
每个Qweb报表解析器类条目的属性:

\u name属性,它总是以
报告开头。

\u inherit='report.abstract\u report' 它是report.abstract_report的默认继承,位于报表模块中(每个报表的基类)

\u模板='test\u module.report\u test\u doc'

基本上是

\u wrapped\u report\u class=report\u parser

它是解析器类条目的一部分,该条目包含报表逻辑和报表的计算逻辑

**还有一件事要调用hello()调用:

在您的例子中,您的函数是declare和added,您的报表解析器类很好,但我们必须在Qweb模板文件上调用该函数

喜欢

<span t-esc="hello()"/>

然后,您将从您的终端调用该函数

我希望我的回答能对您有所帮助:)

模块名称(即目录)大写,请在Odoo11中引发此错误。 例如:

\u name='report.name\u Module.report\u name'

模块名称(即目录)大写,在Odoo11中引发此错误。 例如:


\u name='report.name\u Module.report\u name'

好的,没问题,但最后欢迎您自己努力解决问题。好的,但最后欢迎您自己努力解决问题。在我的情况下,我有大写的
report\u name
,这导致了这个错误。将名称保留为小写后,问题得到解决。谢谢。在我的例子中,我有大写的
report\u name
,这导致了这个错误。将名称保留为小写后,问题得到解决。谢谢