Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How to create and use user defined functions in qweb report?

Stephen Raj
on 2/20/15, 8:41 AM 1,647 views


I've designed qweb report. I couldn't call user defined functions.



File: report/note_notebook.py


from openerp.osv import osv
from openerp.report import report_sxw

class note_notebook(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context=None):
        super(note_notebook, self).__init__(cr, uid, name, context=context)
            'get_text': self._get_text,
        self.context = context

    def _get_text(self):
        return 'Hello World'

class report_notebookview(osv.AbstractModel):
    _name = 'report.notebook.report_notebookview'
    _inherit = 'report.abstract_report'
    _template = 'notebook.report_notebookview'
    _wrapped_report_class = note_notebook


File: views/report_notebookview.xml


<template id="report_notebookview">
    <t t-call="report.html_container">
        <t t-call="report.internal_layout">
            <div class="page">
                    <span t-esc="get_text()"/>


It's showing me following error when I try to print.



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


I don't know what I'm missing here. Please help me to complete this.

Thank you.

Probably code note_notebook.py is not executed, you have note_notebook.py in __init__.py in report folder?

on 2/20/15, 11:17 AM
Alby Antony
On 2/21/15, 3:58 AM


Stephen Raj
On 2/20/15, 11:23 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)


Asked: 2/20/15, 8:41 AM
Seen: 1647 times
Last updated: 3/16/15, 8:10 AM