Odoo Help

3

0
1 Answer
0
Aitor Bouzas Spain
12/29/14, 7:12 AM

Hi,

For the method, first of all, you must write your method in report.py (by "report" y mean the name of the file that contains the Python code...) like this:

class my_class(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context=None):
        super(my_class, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time,
            'method': self._your_method,
        })

    def _your_method(self):
        return 'whatever'

And then call it on your report like this:

[[ method() ]]

For retrieving any value just use [[ (object).(field) ]] bearing in mind that (object) must be the 'string' assigned to the loop [[ repeatIn(object,string) ]] into the same RML. Don't forget to check already done reports as sale_order one into addons/sale/report/

EDIT:

Be sure to place your  [[ method() ]] call into the tags <para></para> so that it appears correctly...

Ask a Question
Writer
Keep Informed
1 follower(s)
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.

Register
Odoo Training Center

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

Test it now