我在qweb报表中遇到了一个问题,我按照本教程http://blog.emiprotechnologies.com/create-qweb-report-odoo/创建了qweb报表,它对当前模块的静态数据运行良好,但当我试图为动态数据创建一个解析器类时,在计算“这是我的python类:
from openerp.osv import osv
from openerp.report import report_sxw
class etudiant_report_parser(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(etudiant_report_parser, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'hello_world': self.hello_world,
})
self.context = context
def hello_world(self):
return "hello"
class etudiant_object_report(osv.AbstractModel):
_name = 'report.gestion_des_etudiants.etudiant_report'
_inherit = 'report.abstract_report'
_template = 'gestion_des_etudiants.etudiant_report'
_wrapped_report_class = etudiant_report_parser
在我的xml文件etudient中_报表.xml我加了一行:
^{pr2}$但是当我打印报告时,我得到了一个错误:
QWebException: "'NoneType' object is not callable" while evaluating
这是我模块的树形图:
/report/init.py<;---加载etudiant_报表.xml它包含解析器类
/报告/学生_报表.py<;--…包含解析器类
/视图/报告_etudiant.xml文件<;---报表的xml文件
初始化.py
打开程序.py
学生_视图.xml在
学生_报表.xml<;---报告菜单
在学习者.py在
另一件事我注意到,当我进入文件夹“report”时,我没有找到任何.pyc文件,用于init.py和etudiant_报表.py在
为了从模型中调用自定义方法,可以执行以下操作。在
在模型中定义方法
然后从qweb调用该方法。下面是从模型调用自定义方法的qweb示例代码。在
^{pr2}$它会帮你的!在
相关问题 更多 >
编程相关推荐