Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
14680 มุมมอง

I'm trying to use report parser, but it always pop an error 

ValueError  The _name attribute report.test_module.report_test_doc is not valid
I searched that your report name is use for the parser _template and _name in order to be used by Odoo. It doesn't show the error if I remove the test_module, but the hello() is not callable.


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>


report_parser.py


from openerp import api, models
from openerp.report import report_sxw
import time
class report_parser(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(report_parser, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'hello_world': self._hello,
})
def _hello(self):
return "Hello World!"

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 = pdc_report_parser


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

I have same problem with you . Can i help me ?

I resolved it!
 My problem:

Name folder of module UPPERCASE raise this error in Odoo11.
Ex: _name = 'report.Name_Module.report_name'

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด
use this code in report_parser.py file.
_wrapped_report_class = report_parser
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
มี.ค. 16
5231
1
มี.ค. 16
11728
1
เม.ย. 25
1176
2
มี.ค. 25
1312
4
พ.ย. 24
7042