Buongiorno a tutti.
Mi sono imbattuto in un problema per il quale sicuramente qualcuno di voi ha già la soluzione.
Vorrei creare un modulo nuovo (test_report) che aggiunga solamente un nuovo report ad un modulo esistente (per esempio al modulo partner). Ora mi trovo in difficoltà poichè quando vado a cliccare sul pulsante del report OpenERP mi da un errore del tipo KeyError. Il modulo che ho fatto è il seguente:
file __init__.py
file __terp__.py
...
'update_xml': ['test_report.xml'],
...
file test_report.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report auto="False" id="test_report_overview" model="res.partner" name="test_report" string="Partner Overview" rml="test_report/report/test_report.rml"/>
</data>
</openerp>
file report/__init__.py
file report/test_report.py
import pooler
import time
from report import report_sxw
class test_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(test_report, self).__init__(cr, uid, name, context)
self.price_total = 0.0
self.grand_total = 0.0
self.localcontext.update({
'time': time,
'price_total': self._price_total,
'grand_total_price':self._grand_total,
})
def _price_total(self):
return str( self.price_total)
def _grand_total(self):
return str( self.grand_total)
report_sxw.report_sxw('report.test.report.overview', 'res.partner', 'addons/test_report/report/test_report.rml', parser=test_report)
file report/test_report.sxw
file report/test_report.rml
generato con tiny_sxw2rml.py partendo dal test_report.sxw
Qualcuno mi sa dire cosa c'è che non va in questo codice?????
Non ne vengo fuori.
Grazie in anticipo per gli aiuti.
Zipgem