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.

1

Temporary variable in aeroo report

By
Francesco OpenCode
on 4/12/13, 8:03 AM 3,616 views

I'm using aeroo report to create a report. I need to insert a temporary variable in a for cicle to incement with some values. It's possible this? Official documentation doesn't explain nothing about this.

Hi Fracesco, i faced the same problem, i found a roundabout by checking the template.ods file in the report_aeroo_printscreen module and how the parser works, it might help you!

SANOU Ibrahim
on 5/28/13, 7:12 AM

I will see the code of this module. Thanks.

Francesco OpenCode
on 5/28/13, 8:56 AM
1

Felipe

--Felipe--
962
| 5 3 8
Bogotá, Colombia
--Felipe--
Informatics engineer Industrial engineer
Felipe
On 6/28/13, 6:40 PM

I found this in aero reports forums http://www.alistek.com/forum/viewtopic.php?f=11&t=473&p=1590#p1590 it was really useful

first you have to define parser in the parser tab of your report:

class Parser(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(Parser, self).__init__(cr, uid, name, context)
        self.localcontext.update({
            'myset':self.myset,
            'myget':self.myget,
            'storage':{}
        })


def myset(self, pair):
        if isinstance(pair, dict):
            self.localcontext['storage'].update(pair)
        return False

def myget(self, key):
    if key in self.localcontext['storage'] and self.localcontext['storage'][key]:
        return self.localcontext['storage'][key]
    return False

then in the reports you can set a variable in this way:

<if test="myset({'test':50})"></if>

then you can call it with:

<myget('test')>

example to modify an already declared variable:

<if test="myset({'test':myget('test')+1})"></if>

yeah it's some way to achieve it, there are also loop options, but what i will really want alistek to do is to permitt the use of more than 2 column loops in the same sheet. I have almost lost all my hairs and was finally forced to use 3 sheets for my report instead of one!

SANOU Ibrahim
on 7/5/13, 7:54 AM

I probably do not know what you mean, because i can implement any x number of loops recursively or independent loops in the same column or row.

Felipe
on 7/5/13, 11:29 AM

Felipe what I mean is for example suppose you have got two tables A & B you wanna make a report on these table lines and u wanna generate the table columns names dynamically (loop on columns) in the same sheet, u'll have to do two different column loops in the same sheet!

SANOU Ibrahim
on 7/31/13, 12:13 PM

10000 thanks !!!

I spent an all day trying to make sumif() working, and I still cannot manage to make it working

Now I managed to do what I needed in 5 min thanks to this tip.

Many thanks .

Thierry Godin
on 12/14/13, 3:22 PM

thumb up if it was of any help ;)

Felipe
on 12/14/13, 7:45 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

0 follower(s)

Stats

Asked: 4/12/13, 8:03 AM
Seen: 3616 times
Last updated: 3/16/15, 8:10 AM