This question has been flagged

i want to print a report for may class contrat commmercial, and this is her code in the fil partnership.py

class contrat(osv.osv):
_name = 'contrat'
_rec_name = 'titreContrat'
_columns = {
    'id_contrat':fields.integer('Numero Contrat'),
    'date_contrat':fields.date('Date Contrat'),
    'titreContrat': fields.char('Titre contrat',size=64),
    'descriptionContrat':fields.text('Description contrat'),
    'lst_termes':fields.one2many('terme','id_terme','Liste des termes'),

}
contrat()
class contratcommercial(osv.osv):
_name='contratcommercial'
_inherit='contrat'
_rec_name = 'titreContrat'
_columns = {
    'id_partenaire_commercial':fields.many2one('commercial','Commercial'),
}
contratcommercial()

i have created the report with openoffice and save it into a file commercialcontrat.sxw and convert it to commercialcontrat.rml and i defined a commercialcontrat.py with thw following code

import time
from openerp.report import report_sxw
class new_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
    super(new_report, self).__init__(cr, uid, name, context)
    self.localcontext.update({
        'time': time,
    })

  report_sxw.report_sxw('report.new_report', 'contratcommercial',
  'addons/partnership/report/commercialcontrat.rml', parser=new_report, header="external")

i have defined import commercialcontrat in the __init__.py and in the file partnership_report.xml i have writed the following codes:

<?xml version="1.0"?>
 <openerp>
    <data>
            <report
                    id="id_commercialcontrat"
                    string="print contrat "
                    model="contratcommercial"
                    name="new_report"
                    rml="partnership/report/commercialcontrat.rml"
                    auto="False"
                    header="False"/>
    </data>

</openerp>

i have always the following error : except_osv: (u'report.new_report', (<type 'exceptions.keyerror'="">, KeyError(u'report.new_report',), <traceback object="" at="" 0x04e64918="">) really i dont know what is the problem please someone help me

Avatar
Discard