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.

0

How to modify a report without overriding it ? Is it possible ?

By
PY
on 11/4/14, 5:48 AM 801 views

Hi !

I have two modules, "foo" and "bar":

"foo" overrides the report account_print_invoice.rml from the account module. It prints the related vouchers below the invoice.
"bar" adds fields to the account.voucher object.

I want "bar" to add these fields in the new report from my first module, only if "foo" is installed.
Must I override the whole report again ? What if one module is installed, and not the other ?

In general, how to modify a report without overriding it ? Is it even possible ?
If not, that means a lot of problems with mods overriding each other's reports...

Thanks !

1
Guillaume Seran
On 11/4/14, 8:24 AM

hi,

you can create a function in your foo_report_parser.py that check if the field exist.
And you call this function in your rml report.It print or not your field value.

That's a nice idea. I will try this out :)

PY
on 11/5/14, 3:12 AM
0

Ben Bernard

--Ben Bernard--
1083
| 4 3 6
Jakarta, Indonesia
--Ben Bernard--
Ben Bernard
On 11/4/14, 9:13 AM

I think "bar" should be ignorance of how report is generated. You said: "It prints the related vouchers below the invoice.", so "foo" already have access to "bar", which is convenience because it can also access fields you defined in "bar".

 

That is not true. "foo" have access to an object, and "bar" extends that object. "foo" would have access to the fields defined in "bar" at all times if I added "bar" in the dependencies list of "foo". But I would not do that, since someone might want to install only one of the two modules. I hope you understand me ^^

PY
on 11/5/14, 3:17 AM

Ahh.. My suggestion imply that bar can be independent. But, "foo" depends on "bar". If you don't want "foo" to depends on "bar", then Guillaume Seran is a good idea, but be aware that it can be hard to maintain in the future.

Ben Bernard
on 11/5/14, 5:43 AM

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: 11/4/14, 5:48 AM
Seen: 801 times
Last updated: 3/16/15, 8:10 AM