Help

0

Show product categories on invoice

Avatar
Cornelius Kraus

Hello guys, 

I started Odoo development few months ago and set up my own module where I added some fields, edited views and defined actions.
Now I am facing a big challenge and do not know how to start. I should add a frontpage to the printed out invoice where you can see the invoiced positions but filtered by their category. 
For example, the categories are "ESX", "EXT" and "COLOR", there should be a frontpage of the invoice where you can see how many products of which category are invoiced, so it should be like
"ESX, 37 products invoiced, 69$ total"
"EXT, 42 products invoiced, 99$ total" and so on.
Is it possible to sum the quantities of products with the same category directly in qweb or has it to be done in python? How to declare the function that computes quantities for only one product category?
I appreciate any answer.
Thanks for your help in advance

Sincerely

Nils Kraus
头像
丢弃
1 答案
0
Avatar
Cornelius Kraus
Best Answer

Maybe this can be done directly in qweb, e.g. like this: 

<span t-esc="sum(line.quantity for line in lines.filtered(lambda r: r.product_id.categ_id == r.product_id.categ_id(11)))"/>

I get an error which says 

"'product.category' object is not callable"

so how can I inherit and use products in account.report_invoice_document_with_payments ?


头像
丢弃