I use report parser, as mentioned in this post :
https://www.odoo.com/forum/help-1/question/how-to-define-a-custom-methods-functions-to-be-used-in-a-qweb-report-how-to-define-and-use-a-report-parser-92244#answer_92245
but I get error, like this..
Can someone tell me solution for this, please...
Traceback (most recent call last): File "/wks/odoo/odoo10/odoo/addons/base/ir/ir_qweb/qweb.py", line 315, in _compiled_fn return compiled(self, append, values, options, log) File "<template>", line 1, in template_768_167 File "<template>", line 9, in foreach_166 File "/wks/odoo/odoo10/addons/hasilmancing/models/hm_report_parser.py", line 21, in _get_catatan_slip_gaji field = self.pool.get('hm_setting')._fields['catatan_slip_gaji'] AttributeError: 'hm_report_parser' object has no attribute 'pool' Error to render compiling AST AttributeError: 'hm_report_parser' object has no attribute 'pool' Template: 768 Path: /templates/t/div/t/div/div[12]/i/span Node: <span t-esc="_get_catatan_slip_gaji()"/>
Hi Eries, in the given link it is of v9 and below, as you are using the Odoo v10> you can easily create parser file by checking this link, https://www.odoo.com/documentation/10.0/reference/reports.html,
If you want to go in same way, please add the code in question so that it can be easily traced out
@Niyas Raphy thanx for reply, I tried it, but no luck, PDF has generated, but no content, blank white only...
this is my code..
from odoo import api, models
class hm_report_parser(models.AbstractModel):
_name = 'report.hasilmancing.pay_slip_report_template'
_template = 'hasilmancing.pay_slip_report_template'
@api.model
def render_html(self, docids, data=None):
report_obj = self.env['report']
report = report_obj._get_report_from_name(self._template)
docargs = {
'doc_ids': docids,
'doc_model': 'report.hm_payroll_driver',
'docs': self,
'_get_catatan_slip_gaji': self._get_catatan_slip_gaji
}
# return report_obj.render('hasilmancing.pay_slip_report_template', docargs)
return report_obj.render(self._template, docargs)
def _get_catatan_slip_gaji(self):
return 'Report Parser for get catatan method'