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

How to sum a column in openoffice report?

By
evon_dun
on 5/16/13, 7:51 AM 6,603 views

I need to sum the amount_tax in a report just like it shows in the account_invoice tree view or sales_order view as a total in my invoice report, i don't want lines in my invoice. please help its seriously very urgent!

Can we write a function to add amount_total in sale_order report.py? anyone? please guide me in writing simplest way

evon_dun
on 5/23/13, 4:38 AM

Can anyone help !! Damn important.

evon_dun
on 6/21/13, 7:36 AM
2
codefans
On 7/16/13, 7:57 AM

[[ reduce(lambda x, obj: x+obj.amount_total , objects , 0 ) ]]

Tried this but no result, changed to this too [[ reduce(lambda x, invoice: x+invoice.amount_total , objects , 0 ) ]]

evon_dun
on 7/16/13, 8:29 AM

i use it for purchase order it work well

codefans
on 7/16/13, 11:55 PM

please try in invioce report for the amount total

evon_dun
on 7/17/13, 2:33 AM

more info https://doc.openerp.com/v6.1/developer/05_reports/

codefans
on 7/17/13, 2:59 AM
3

Francesco OpenCode

--Francesco OpenCode--
3608
| 5 7 9
Grottaglie, Italy
--Francesco OpenCode--

Italian Odoo (OpenERP) Modules Developer LINKEDIN: http://www.linkedin.com/in/francescoapruzzese

Francesco OpenCode
On 5/16/13, 8:17 AM

Aeroo has got a funtion called sum_field that sum all the value for a field in yuor class.

This is an example that sum all amount_total in sale order

sum_field(o, 'amount_total')

This is a link to official documentation: http://www.alistek.com/wiki/index.php/Extra_Functions_-_sum

But I am using openoffice can it work???

evon_dun
on 5/16/13, 8:50 AM

Aeroo is based on OpenOffice!!

Francesco OpenCode
on 5/16/13, 11:20 AM

it didn't work with openoffice

evon_dun
on 5/22/13, 8:57 AM

what error you get?

Francesco OpenCode
on 5/22/13, 8:58 AM

i don't get an error but it doesn't print anything. I want to sum amount total of all the invoices in my report like it does in invoice tree in openerp. Please help

evon_dun
on 5/22/13, 9:04 AM

can you help in writing a function in report.py??

evon_dun
on 5/23/13, 4:36 AM

evon_dun: listen to me. The sum_field function work fine in openerp aeroo report. I use it everywhere and i haven't problem. If the function doesn't work you are doing something wrong. Post you code and we can halp you. If you search only help without explain what are you doing is impossible for use help you.

Francesco OpenCode
on 5/23/13, 11:15 AM

[[ sum_field(invoice,'amount_total') ]]

evon_dun
on 5/24/13, 1:58 AM

But you are using rml not aeroo report!!!

Francesco OpenCode
on 5/24/13, 5:16 AM

kindly guide me the complete way to add such a field either through programming or through openoffice. In openoffice either we add field from field builder or we can use rml.

evon_dun
on 5/24/13, 5:24 AM

My answer is in relation with aeroo reports. Rml is another report engine. Sorry but my answer is incorrect in your case.

Francesco OpenCode
on 5/24/13, 5:59 AM

France please show that this solution for Aeroo in the main answer and thx it helped me :)

Elmasry
on 6/3/13, 3:25 PM

No aeroo solution please

evon_dun
on 6/21/13, 7:38 AM
2

Keyur

--Keyur--
1165
| 4 4 8
Ahmedabad, India
--Keyur--

Odoo Expert

Keyur
On 6/26/13, 7:50 AM

Hi evon,

Above suggested answer is right. It uses report_aeroo functionality if you want to achieve it with base_report_designer using sxw & report.py file then you need to follow below steps.

Define a global variable & do the calculation for sum in it in report.py file. Then at the end of the report in .sxw file call a function and return that global variable. This is how you can have sum amount in your report at the end. For more in detail you can refer Location Content report of Stock.

Here are some examples,

For version 6.0

For version 7.0

Hope this solve your problem.

Thanks.

Probably you are right but that example is too complicated, any other example?? However, i have been trying to install aeroo on my system for windows which at last gets stuck on Genshi. I don't understand how to get out of this since i have python 3.2 and it is failed for 3.2 on windows. Any idea!

evon_dun
on 6/26/13, 9:17 AM

Oh come on evon! It is very easy,I am sure you can do it. I already gave you simplest example. If you know how to call a method from sxw then it is very simple you don't even need any params while calling the method for total. You just need to write [[ your_method() ]] in rml or sxw at the end.That's it. I prefer you just to try it. If you are stuck in between, we members are here & ready to help :)

Keyur
on 6/26/13, 9:27 AM

have you checked properly there are more methods related to that report file in stock.py too

evon_dun
on 6/26/13, 9:33 AM

I have checked RML file price_total() is called to do total. Same as you need to define method in rml file & in report.py file and return the global variable in which you have done calculation.

Keyur
on 6/26/13, 10:24 AM
0
kirti joshi
On 9/12/14, 6:00 AM

I am using sum_field in aeroo reports but it gives error that  iteration is not allowed on browse_record .

please clearify your question?

LIfe
on 9/12/14, 6:10 AM

I want to sum up one numeric field from my table for all the employees as a grand total of tabular data . Using aeroo report i am able to fetch the fields from the database but when I use sum_field function to add the elements it gives me error that iteration is not allowed on browse_record . Please help me for how to use extra functions of aeroo reports.

kirti joshi
on 9/16/14, 2:55 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

4 follower(s)

Stats

Asked: 5/16/13, 7:51 AM
Seen: 6603 times
Last updated: 3/16/15, 8:10 AM