This question has been flagged

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

First Invoice:
  Painting: 20 m2
  SubTotal: 200€
  To Deduct: 0€
  Total: 200€

Now the client pays it and the next day we paint 30 m2 more and the next invoice is gonna read:

Second Invocie:
 
Painting: 20 m2
  Painting: 30 m2
  SubTotal: 500€
  To Deduct: 200€ (because they are paid from the past invoice)
  Total: 300€

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:

  1. 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.

  2. 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

    <t t-foreach...

    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.

Avatar
Discard
Best Answer


Hola Magen, have to talk to you in english because of forum rules. 

Wouldn't it be easier to just use a proforma invoice? 

Avatar
Discard