Odoo Help

Welcome!

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.

3

how to retrieve values to RML Report ?

By
DEDE
on 12/26/14, 3:23 AM 772 views

I would like to take product's internal reference in purchase.requisition to make an output as Product Code in Purchase Requisition Report.

I also want to make a method to get a total number of quantity , do i have to write in report.py or inherit purchase.requisition.py ? how can i write the code both RML and PY ?

Thanks in advance ..

 

I've applied but the output in the report does not appear are there any other suggestions? thanks

DEDE
on 12/29/14, 8:08 AM
0
Aitor Bouzas
On 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...

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

1 follower(s)

Stats

Asked: 12/26/14, 3:23 AM
Seen: 772 times
Last updated: 3/16/15, 8:10 AM