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 create an invoice with separate positions for each task

By
Falta
on 11/12/13, 4:25 PM 2,266 views

When you create an invoice from the Invoice Tasks menu and you select multiple tasks they all get stuffed in one position in the invoice. This leads to very long descriptions of on position and is very obscure for customers in a bigger project with a lot of tasks.

Separate positions are only created if the tasks are invoiceable in different ways (i.e. when there are 5 Tasks with a 10% discount and 15 with 0% OpenERP would generate two positions).

How can I tell OpenERP to generate one position in the invoice for each task?

0

Fabien Pinckaers (fp)

--Fabien Pinckaers (fp)--
6598
| 6 8 8
fsdsdfsdf, Belgium
--Fabien Pinckaers (fp)--

Odoo Founder & CEO

Fabien Pinckaers (fp)
On 11/12/13, 6:47 PM

Not supported by default, you will need a custom module.

You can eventually work in another way:

  • create sales order with several lines
  • use Project_mrp module so that SO creates tasks
  • invoice based on sales order, not on tasks

Other approach based on tasks:

  • invoice with one line but with putting the details
  • attach timesheets in another document that you send with the invoice
0
exxor
On 2/26/14, 4:50 PM

This is actually quite easy to do.

If you want for example to aggregate the positions by date you can do it like this (really only one line per task should work the same way but instead of date you should pick the line id):

In your OpenERP addons folder search for the hr_timesheet_invoice addon. Open its hr_timesheet_invoice.py.

Search for:

cr.execute("""SELECT product_id, user_id, to_invoice, sum(amount), sum(unit_amount), product_uom_id

Replace it with:

cr.execute("""SELECT product_id, user_id, to_invoice, sum(amount), sum(unit_amount), product_uom_id, date

Search for:

GROUP BY product_id, user_id, to_invoice, product_uom_id""", (account.id, tuple(ids), journal_type))

Replace it with:

GROUP BY product_id, user_id, to_invoice, product_uom_id, date""", (account.id, tuple(ids), journal_type))

Search for:

for product_id, user_id, factor_id, total_price, qty, uom in cr.fetchall():

Replace it with:

for product_id, user_id, factor_id, total_price, qty, uom, date in cr.fetchall():

Search for:

cr.execute("SELECT * FROM account_analytic_line WHERE account_id = %s and id IN %s AND product_id=%s and to_invoice=%s ORDER BY account_analytic_line.date", (account.id, tuple(ids), product_id, factor_id))

Replace it with:

cr.execute("SELECT * FROM account_analytic_line WHERE account_id = %s and id IN %s AND product_id=%s and to_invoice=%s and date=%s ORDER BY account_analytic_line.date", (account.id, tuple(ids), product_id, factor_id, date))

That should work also I haven't it tested it very long.

To do it properly I guess you should create a custom module with the modified hr_timesheet_invoice.py which overwrites the original rather than directly modifing the original itself (as it will get overwritten at the next update) but I'm very new to OpenERP and haven't looked into the module structure yet... I guess I'll delay it until I have to update my version.

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

1 follower(s)

Stats

Asked: 11/12/13, 4:25 PM
Seen: 2266 times
Last updated: 3/16/15, 8:10 AM