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 use python function in openoffice?

on 7/15/13, 7:20 AM 1,261 views

I have a function which selects a query from database and returns a result, I want to use this function in my openoffice report, please help on how to call that function in the report.

On 7/15/13, 9:42 AM

You should add methods you want to use in the report in the python file inside report folder of your module. For example:

class picking(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
            'time': time,

    def _your_method(self,value):
        result = []
        object = self.pool.get('object.name')
        # DB query
        return result

In self.localcontext.update, you have to add the new methods added, so that they are "visible" from the RML file, together with the method they are related to.

You should call your new method from the RML file using the following code:

[[ your_method_name_from_rml(o.value) ]]

Hope you find this useful

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: 7/15/13, 7:20 AM
Seen: 1261 times
Last updated: 3/16/15, 8:10 AM