Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
4 Replies
15133 Tampilan

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!

Avatar
Buang
Penulis

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

Penulis

Can anyone help !! Damn important.

Jawaban Terbai

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

Avatar
Buang
Penulis

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

i use it for purchase order it work well

Penulis

please try in invioce report for the amount total

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

Jawaban Terbai

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

Avatar
Buang
Penulis

But I am using openoffice can it work???

Aeroo is based on OpenOffice!!

Penulis

it didn't work with openoffice

what error you get?

Penulis

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

Penulis

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

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.

Penulis

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

But you are using rml not aeroo report!!!

Penulis

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.

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

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

Penulis

No aeroo solution please

Jawaban Terbai

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.

Avatar
Buang
Penulis

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!

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 :)

Penulis

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

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.

Jawaban Terbai

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

Avatar
Buang

please clearify your question?

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.

Post Terkait Replies Tampilan Aktivitas
1
Mar 15
6935
1
Mar 15
4886
1
Mar 15
4255
0
Mar 15
3618
1
Apr 25
921