sale_report.py::
import time
from report import report_sxw
from osv import osv
class psale(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context=None):
super(psale, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'cr':cr,
'uid': uid,
'getname': self._getname,
})
self.context = context
def _getname(self,section_id):
sql="select res.name from res_users as res,crm_case_section as ccs \
where res.id=ccs.user_id and ccs.id=%d" %(section_id)
self.cr.execute(sql)
return self.cr.fetchall()
report_sxw.report_sxw('report.sa.quot.re',
'sale.order',
'addons/lunch/sale_report/sale_report.mako', parser=psale,
)
------------------------------------------------------------------------------------------------------
sale_report.mako:::
<% tb=getname(usr.section_id) %>
${tb}
----------------------
too, import sale_report in __init__.py , restart server
please help me!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!