This question has been flagged

this error when i try to print the report 

QWebException: "'NoneType' object is not callable" while evaluating
'getRecords(l)'

report_selector_temp.xml

<tr t-foreach="o.record_ids" t-as="l">
<td>
<strong><span t-field="l.model_object_field"/></strong>
</td>
<td>
<strong><span t-field="l.user_field"/></strong>
</td>
<td>
<strong><span t-field="l.sequence"/></strong>
</td>
<td class="text-right">
</td>
<tr t-foreach="getRecord(l)" t-as="record">
<td>
<span t-esc="record"/>
</td>
<td>
<strong><span t-field="l.user_field"/></strong>
</td>
<td>
<strong><span t-field="l.sequence"/></strong>
</td>
 



report_xml.py 

class modelgenerator(report_sxw.rml_parse):
def
__init__(self, cr, uid, name, context):
super(modelgenerator, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'getRecord': self._records_get,
})
self.context = context



def _records_get(self,line):
 
model_obj = self.pool.get(line.report_generator_id.model_id.model)
model_ids = model_obj.search(self.cr,self.uid,[])
model_data_ids = model_obj.browse(self.cr,self.uid,model_ids)
line_field_records = model_data_ids.mapped(line.model_object_field.name)
return line_field_records


class report_selector(models.AbstractModel):
_name = 'xsl.report.files.report_selector_docs'
_inherit = 'report.abstract_report'
_template = 'report_selector_docs'
_wrapped_report_class = modelgenerator
Avatar
Discard