本文介绍了OpenERP 7报告错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

report.bpl.daily.transaction

(<type 'exceptions.KeyError'>, KeyError(u'report.bpl.daily.transaction',), <traceback object at 0xb1911f04>)

现在我要报告生成部件.我在openerp&中引用更多模块创建了自己的代码.但是当我单击打印按钮时,会出现上述错误.我的要求是在 bpl.daily.transaction.master 表中获取所有数据,查看它们.

now I'm going to report generating part.i refer more modules in openerp & created my own code.but above error comes when i clicked print button.my requirement is get all data in bpl.daily.transaction.master table & view them.

请建议我实施此

这是我的 bpl_report.py

class bpl_daily_transaction_report(osv.osv_memory):
    _name = 'bpl.daily.transaction.report'
    _description = 'bpl daily transaction report'
    _columns = {
        'bpl_company_id':fields.many2one('res.company', 'Company', help='Company'),
        'bpl_estate_id':fields.many2one('bpl.estate.n.registration', 'Estate', help='Estate'),
        'bpl_division_id':fields.many2one('bpl.division.n.registration', 'Division', help='Division', domain="[('estate_id','=',bpl_estate_id)]"),
        'date': fields.date('Date', required=True),
    }
    _defaults = {'date': lambda *a: time.strftime('%Y-%m-01'),}

    def print_report(self, cr, uid, ids, context=None):
        datas = {
             'ids': [],
             'model': 'bpl.daily.transaction.master',
             'form': self.read(cr, uid, ids)[0]
        }
        return {
            'type': 'ir.actions.report.xml',
            'report_name': 'bpl.daily.transaction',
            'datas': datas,
        }
bpl_daily_transaction_report()

这里显示了我的bpl_report.xml文件.这里似乎有问题.我仍处于openerp报告的初学者级别.

and here shows my bpl_report.xml file.seems issue in here.i'm still at beginner level in openerp reporting.

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="daily_transaction_report_action" model="ir.actions.act_window">
    <field name="name">Daily Transaction Report</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">bpl.daily.transaction.report</field>
    <field name="view_type">form</field>
    <field name="view_mode">form,tree</field>
    <field name="target">new</field>
</record>
<record id="daily_transaction_report_view" model="ir.ui.view">
    <field name="name">bpl.daily.transaction.report.form</field>
    <field name="model">bpl.daily.transaction.report</field>
    <field name="arch" type="xml">
    <form string="Daily Transaction Report" version="7.0">
        <field name="bpl_company_id" />
        <field name="bpl_estate_id" />
        <field name="bpl_division_id" />
        <field name="date" />
        <footer>
        <button name="print_report" string="Print" type="object"
            class="oe_highlight" />
        or
        <button string="Cancel" special="cancel" class="oe_link" />
        </footer>
    </form>
    </field>
</record>

<report id="report_bpl_daily_transaction" string="Daily Transaction"
    model="bpl.daily.transaction.report" name="bpl.daily.transaction"
    auto="False" menu="False" />
<menuitem id="menu_checkroll_reporting" parent="base.menu_reporting"
    name="Checkroll" />
<menuitem id="menu_checkroll_reports" name="Reports"
    parent="menu_checkroll_reporting" />
<menuitem name="Daily Transaction Report" parent="menu_checkroll_reports"
    action="daily_transaction_report_action" id="menu_daily_transaction_report" />
</data>
</openerp>

请帮助我解决此问题.

推荐答案

从错误看来,报表命名约定似乎是一个问题.您在任何地方错误地指定了服务名称.应该是这样的:

From error, it looks like an issue is with report naming convention. service name is wrongly specified by you anywhere. It should be like this:

在module_report.xml中->应该是简单的名称='bpl.daily.transaction'.

in module_report.xml --> It should be simple name='bpl.daily.transaction'.

解析时来自report.py,应为"report.bpl.daily.transaction",如下所示:

From report.py while parsing, It should be 'report.bpl.daily.transaction' as below:

report_sxw.report_sxw('report.bpl.daily.transaction', 'bpl.daily.transaction', 'RML_PATH_OF_REPORT', parser=PARSER_NAME)

从向导进行打印时,作为回报,它应该是"bpl.daily.transaction",并且在您看来还可以.

During Printing from wizard, in return, it should 'bpl.daily.transaction' and it seems ok at your end.

在您结束时检查并使其正确.应该可以.

Check this at your end and make it proper. It should work.

这篇关于OpenERP 7报告错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 11:58