Odoo Help


how to create pdf report with db parameters

on 4/21/14, 9:11 AM 1,101 views

hi i have created query in python file class project_list_print(report_sxw.rml_parse): def lines(self, dm_name_id, *args): self.cr.execute('SELECT dm_name.id as dm_name_id,dm_name.name FROM res_users dm,res_partner dm_name WHERE dm.partner_id = dm_name.id and dm_name.id = %s', (dm_name_id,)) ids = map(lambda x: x[0], self.cr.fetchall()) logging.info('----------------------------------') res = self.pool.get('account.analytic.line').browse(self.cr, self.uid, ids) return res

def __init__(self, cr, uid, name, context):
    super(project_list_print, self).__init__(cr, uid, name, context=context)
        'time': time,
        'lines': self.lines,

report_sxw.report_sxw('report.project.list.report','project.list.report','addons/project_htc/report/project_list_report.rml',parser=project_list_print, header=False)

using this file how to call and generate report??


Dhinesh - Technical Consultant, Sodexis Inc

--Dhinesh - Technical Consultant, Sodexis Inc--
| 5 4 9
Pondicherry, India
--Dhinesh - Technical Consultant, Sodexis Inc--

Passionate coder in Python/OpenERP. Knows Django/Flask MVC frameworks. Did code in Java, PHP.

Contact me at: dvdhinesh.mail@gmail.com

Dhinesh - Technical Consultant, Sodexis Inc
On 4/21/14, 9:52 AM

Hi, You can call any function in py from rml report.

Code in Your py file

class report(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context=None):
        super(report, self).__init__(cr, uid, name, context=context)
            'time': time,
            'checkbalance': self.checkbalance

    def checkbalance(self, var1, var2):
        var3 = var1 + var2
        return var3

Call this code from sxw like


Or you can call the method directly from rml file using:

[[ checkbalance(10,5) ]]

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 4/21/14, 9:11 AM
Seen: 1101 times
Last updated: 3/16/15, 8:10 AM