Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

(<type 'exceptions.KeyError'>, KeyError(u'report.warranty.warranty.collection_docket',), <traceback object at 0xb44992d4>)

By
sneha antony
on 3/13/14, 1:17 AM 4,320 views

I have placed a print button in a newly developed module warranty info.The module for reports in the warranty module is added separately in the addons directory.All the other things are working fine.But when I click on the print button in the form,following error appears.The screenshot is attached.Screenshot-2.png.The corresponding file in addons/module/reports.xml have the code

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
    <report auto="False" id="collection_docket" model="warranty.warranty" name="warranty.warranty.collection_docket" rml="print/report/collection_docket.rml" string="Warranty Details" />
</data>
</openerp>

Can you please show the parser section of your report?

Zesty Beanz Technologies, Prajul P T
on 3/13/14, 2:07 AM

Is this the section you mean?# -- coding: utf-8 -- import time from openerp.report import report_sxw

class warranty(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(warranty, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, }) report_sxw.report_sxw( 'report.warranty', 'warranty', 'addons/print/report/collection_docket.rml', parser=warranty )

sneha antony
on 3/13/14, 2:11 AM

I am not sure about the whether the .py code is correct or not.Here warranty is the name of the module for which the report is to be made

sneha antony
on 3/13/14, 2:17 AM

I think you have given the name of the report as "report.warranty" in your py file of the report and in xml you have given it as "warranty.warranty.collection_docket". If you are giving the name as "warranty.warranty.collection_docket" in xml file, the name of the report in py file should be "report.warranty.warranty.collection_docket".

Zesty Beanz Technologies, Prajul P T
on 3/13/14, 2:19 AM

Is there any naming convention or specific name to be given here?

sneha antony
on 3/13/14, 2:21 AM

There is no naming convention. If you are giving the name of the report as say "example_report_name", the name of the report should be in "report.example_report_name". Prefix should be "report."

Zesty Beanz Technologies, Prajul P T
on 3/13/14, 2:29 AM

I tried as per your instructions but still the same error occurs. report.warranty.warranty.collection_docket

(<type 'exceptions.KeyError'>, KeyError(u'report.warranty.warranty.collection_docket',), <traceback object at 0xb3f46c0c>)

sneha antony
on 3/13/14, 2:40 AM

Have doubt regarding coding . report_sxw.report_sxw( 'report.warranty.warranty.collection_docket', 'warranty.warranty', 'addons/print/report/collection_docket.rml', parser=warranty ). Here what do report.warranty.warranty.collection_docket and warranty.warranty represent?

sneha antony
on 3/13/14, 2:43 AM

Can you please tell me where the location of the files for this report are like the location of py, xml and rml files.

Zesty Beanz Technologies, Prajul P T
on 3/13/14, 2:44 AM

Please read https://doc.openerp.com/v6.1/developer/05_reports/ . Its a document on how to create rml reports in openerp.

Zesty Beanz Technologies, Prajul P T
on 3/13/14, 2:47 AM

I have added a separate module 'print' in the addons directory and the reports.xml is in that module while collection_docket.rml and .py file are inside a folder named report in the module print.

sneha antony
on 3/13/14, 2:47 AM

Please check if you have added py file in __init__.py file.

Zesty Beanz Technologies, Prajul P T
on 3/13/14, 2:57 AM

Yes I have added .py file in __init__.py as import warranty_info

sneha antony
on 3/13/14, 3:02 AM

Can you share your module files like py file, xml file, __init__.py files and __openerp__.py file?

Zesty Beanz Technologies, Prajul P T
on 3/13/14, 3:06 AM

I have added a new module print.The folder print contains __init__.py __openerp__.py report folder & reports.xml.

sneha antony
on 3/13/14, 3:11 AM

__init.py__

import report

sneha antony
on 3/13/14, 3:11 AM

__openerp__.py { 'name': 'Extra Warranty Reports', 'version': '0.01', 'category': 'Reports for WARRANTY', 'description': """ The extra sales reports needed for our project,

  • Reports

    • Collection Docket

    """, 'author': 'OpusVL', 'website': 'http://www.opusvl.com', 'init_xml': [], 'update_xml': [ 'reports.xml', ], 'demo_xml': [], 'test': [], 'installable': True, 'active': False, }

sneha antony
on 3/13/14, 3:13 AM

reports.xml <?xml version="1.0" encoding="utf-8"?> <openerp> <data> <report auto="False" id="report_collection_docket" model="warranty.warranty" name="collection_docket" rml="print/report/collection_docket.rml" string="Warranty Details" /> </data> </openerp>

sneha antony
on 3/13/14, 3:14 AM

print/report/collection_docket.rml - code for the print layout(not designed yet).

sneha antony
on 3/13/14, 3:15 AM

print/report/__init__.py import warranty_info

sneha antony
on 3/13/14, 3:16 AM

print/report/warranty_info.py # -- coding: utf-8 -- import time from openerp.report import report_sxw class warranty(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(warranty, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, }) report_sxw.report_sxw( 'report.collection_docket', 'warranty.warranty', 'addons/print/report/collection_docket.rml', parser=warranty )

sneha antony
on 3/13/14, 3:17 AM

-- coding: utf-8 --

import time from openerp.report import report_sxwclass warranty(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(warranty, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, }) report_sxw.report_sxw( 'report.collection_docket', 'warranty.warranty', 'addons/print/report/collection_docket.rml', parser=warranty )

vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

sneha antony
on 3/13/14, 3:38 AM

I followed exactly the same steps as you mentioned and i was able to generate report. Please try updating your module.

Zesty Beanz Technologies, Prajul P T
on 3/13/14, 6:16 AM

I am still working on it any no improvement at all.Did you restarted the server or anything like that?I tried and tried and tried and still the same error (<type 'exceptions.KeyError'>, KeyError(u'report.collection_docket',), <traceback object at 0xb3b7439c>) is being displayed

sneha antony
on 3/13/14, 6:24 AM

yes. I restarted the server, updated the module in db..

Zesty Beanz Technologies, Prajul P T
on 3/13/14, 7:06 AM

ok.How to update the module in db

sneha antony
on 3/13/14, 7:18 AM

Go to settings > Modules > Installed Modules. Search for your module here. Open the record you get after searching for module. You can find your module details here. You can also find a button named "Update".

Zesty Beanz Technologies, Prajul P T
on 3/13/14, 8:06 AM

I tried that too.In openerp version that I am using,it is upgrade button.After making changes I saved tose files then updated the modules list,from the installed modules list the module has been searched out and then upgraded that module.Then refreshed and tried to print the report again but still the error remains.

sneha antony
on 3/13/14, 8:23 AM

I tried the module and was installed successfully.But the I cant understand the changes that module made in the openerp.Where is the button placed?I didnt see any new button in any of the modules.

sneha antony
on 3/14/14, 2:23 AM

I find the button.It is not placed as a separate button but the module installed produced another heading in the print button in the Quotations.When the second string "Warranty Details" is clicked,the old error report.collection_docket

(<type 'exceptions.KeyError'>, KeyError(u'report.collection_docket',), <traceback object at 0xd12ca04>) appers

sneha antony
on 3/14/14, 2:39 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 3/13/14, 1:17 AM
Seen: 4320 times
Last updated: 9/19/16, 5:50 AM