OpenERP报告创建失败

时间:2013-08-02 11:04:20

标签: xml report openerp rml

我一直在尝试在OpenERP的报告模块下创建一个calldetails报告。 我想报告与报告/销售点/销售细节相同。 我做了文档中指定的步骤,但模块没有显示。

这是我的报告xml(在calldetails / report / calldata_report.xml内)

            <?xml version="1.0"?>
            <openerp>
                    <data>
                            <report
                                    id="report_calldata"
                                    string="call details"
                                    model="calldata"
                                    name="report.calldata_report"
                                    rml="calldetails/report/calldata_report.rml"
                                    auto="False"/>
                    </data>
        </openerp>

我的模型是(在calldetails / calldata.py内)

        from osv import osv,fields
          class calldata(osv.osv):
            _name = 'calldata'
            _columns = {
              'Call_start': fields.datetime('Call start'),
              'Call_duration':fields.datetime('Call duration'),
              'Ring_duration':fields.float('Ring duration'),
              'Caller':fields.char('Caller'),
              'Direction':fields.char('Direction'),
              'Called_number':fields.char('Called number'),
              'Dialled_number':fields.char('Dialled number'),
              'Account':fields.char('Account'),
              'Is_Internal':fields.boolean('Is internal'),
              'Call_ID':fields.char('Call id'),
              'Continuation':fields.boolean('Continuation'),
              'Party1Device':fields.char('Party1device'),
              'Party1Name':fields.char('Party1name'),
              'Party2Device':fields.char('Party2device'),
              'Party2Name':fields.char('Party2name'),
              'Hold_Time':fields.float('Hold time'),
              'Park_Time':fields.float('Park time'),
           }
        calldata()

我的报告对象创建代码是(在calldetails / report / calldata_report.py中)

        from report import report_sxw
        from osv import  osv
        class test_parser(report_sxw.rml_parse):
         def __init__(self,cr,uid,name,context):
           super(test_parser, self).__init_(cr,uid,name,context=context)
           self.localcontext.update({})
        report_sxw.report_sxw('report.calldata_report',
                               'calldata',
                                'addons/calldetails/report/calldata_report.rml',
                                parser=test_parser )

在记录文件夹中我添加了 init .py(我导入了calldata_report.py)和calldata_report.rml文件(包含从sale / report / sale / sale_order.rml复制的代码)

 and in (calldetails/__.openerp__.py) I added
 {"name" : "SMDR",
        "version" : "1.0",
        "author" : "Anuradha",
        "category" : "Generic Modules",
        "description": "call details",
        "website":"added website here but i cant post it due to insuffient karma",
        "depends" : ["base"],
        "init_xml" : [],
        "update_xml" : ["initial.xml","calldata_display.xml","report/calldata_report.xml"],
    #    "data":["calldata_report.xml"],
        "installable": True,
        "active": False
    }

并在calldetails / init .py中添加了报告模块。 请帮助我找到我一直在研究它的问题

1 个答案:

答案 0 :(得分:0)

试试这个

<强> calldata_report.xml

<?xml version="1.0"?>
            <openerp>
                    <data>
                            <report
                                    id="report_calldata"
                                    string="call details"
                                    model="calldata"
                                    name="calldata.report"
                                    rml="calldetails/report/calldata_report.rml"
                                    auto="False"/>
                    </data>
        </openerp>

<强> calldata_report.py

report_sxw.report_sxw('report.calldata.report',
                               'calldata',
                                'addons/calldetails/report/calldata_report.rml',
                                parser=test_parser )