More and more often our clients (construction company) are asking for invoice showing the total amount of work done until now. For example:
Project: Painting a house
Total amount: 100 m2
Price: 10€ per m2
Painting: 20 m2
To Deduct: 0€
Now the client pays it and the next day we paint 30 m2 more and the next invoice is gonna read:
Painting: 20 m2
Painting: 30 m2
To Deduct: 200€ (because they are paid from the past invoice)
So every next invoice is gonna have the lines of the past invoices (for that project) deducting the amount that is payed. Basically I want to print a report for an invoice having the Header of the current invoice but the orderlines including all the lines from the past invoices of that project and in the footer having SubTotal from All the lines and Deducting what is payed for the Total.
So the question is: How can you achieve that with Odoo v9? The first thing I imagine is adding an Many2one field "Project" to the account.invoice so you can sort them by Project.
Now about the invoice I had a few ideas:
Making a report layout and looping through all the invoices checking if they belong to the current invoice project and adding the orderlines + checking which of them was payed to deduct from the total. Is it possible from Report for model "account.invoice" to access other invoices? smth like
<t t-foreach="docs" t-as="o">
but for all invoices.
Another thing I thought was to make a filter on the added "Project field" so i can see only the invoices for certain Project and the report will loop with
Adding all the order lines to the report. The problem here is how do you know for which invoice you make the report. Since I'll need to have the Invoice Number for example in the header.
Well you can see I am quite lost with this. I would appreciate any help.
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
|Asked: 5/25/16, 5:06 PM|
|Seen: 281 times|
|Last updated: 5/25/16, 11:14 PM|