hr_timesheet_invoice: lines are not sorted by date

Bug #594139 reported by jugglefish
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Low
Unassigned

Bug Description

if using the wizard 'wizard/hr_timesheet_invoice_create.py' of 'hr_timesheet_invoice' the note on hte inviced line gets added all dates and descriptions from corresponding timesheet entries. However these are not sorted by the correct date.

Related branches

Revision history for this message
JMA(Open ERP) (jma-openerp) wrote :

Hello Jugglefish,

We have sorting done on the basis of the 'Invoice Number'.
In invoice.py :
_name = "account.invoice"
_order = "number"

However, you can have the invoices sorted on the basis of other field(date) for example by using:
_order="date_invoice"

Hope this helps.

Thank you.

Revision history for this message
jugglefish (pniederlag) wrote :

Hello,

The bug is not about the sorting of invoices. It is about the 'hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py'.

This wizard does create an invoice (and obviously also the invoice_line). The submitted note added on the invoice.line is created by using something like '1.5 hours text 2 hours foobar 3.6 hours whatever' when requested. This all goes into ONE account.invoice.line.note. However since the data is gathered before from (probably) multiple 'account_analytic_line' entries, which where NOT ordered when queried, the note does not reflect the proper time-coding of the 'account_analytic_line' lines.

That's why it is IMO very reasonable to add some Order Statement on line 152.

Can you please try to have a look at it again?

Revision history for this message
JMA(Open ERP) (jma-openerp) wrote :

Hello Jugglefish,

Would you please provide a more detailed explanation with complete steps you follow, preferably a screen-shot to better understand the entire scenario and assist you further.

Thank you.

Revision history for this message
jugglefish (pniederlag) wrote :

(GTK Clien)
Prerquisities: needs setup for invoicing based on timesheet, provided by addon 'hr_timesheet_invoice'

1. click "Financial Management/Periodical Processing/Entries To Invoice/Uninvoiced Entries"
2. From The Top Toolbar click "actions"
3. Wizard Form will show, "Do you want to show details of work in invoice?" -> Select "Date" , "Time Spent", "Name of entry" (see attached screenshot)
4.Click "Create Invoices" and an invoice should have been created
5. On the created invoice, select the "Invoice Line" and open it. Have a look at the second tab "Notes"

the lines on the notes tab might be in correct order, but that's IMO more or less random now.

Revision history for this message
JMA(Open ERP) (jma-openerp) wrote :

Hello Peter,

I followed the steps provided by you.
And the behaviour is perfect.

The lines on the "note" tab are in correct order.
The grouping is done on the basis of the account type.
i.e The products of the same account type have been grouped to gather.

So when you invoice multiple analytic lines and if they have same account type they will be grouped and that is very obvious.

Would you please provide the details about the analytic entries on your side as in:
*what are the account types
*the type of products.

Thank you.

Revision history for this message
jugglefish (pniederlag) wrote :

it does not make any difference on the account type or type of product.
* Have a project with tasks
* Encode some time entries on the task (time entries will be shown on the task sorted by date, very nice and correct)

# now comes the crucial part:

* change the comment(or even the date/time) on any older time entry(not the most recent one!) from the task view
* create the invoice

the concatenated note from all analytic entries in the (one and only) line of the invoice is kind of randomly sorted(?), due to the absence of an order by statement:

example:
-----------------------
2010-04-06 - 1.0 Hour - xyz
2010-06-22 - 1.0 Hour - xyz
2010-06-18 - 0.5 Hour - xyz
2010-06-21 - 0.75 Hour - xyz
2010-04-13 - 0.5 Hour - xyz
-----------------------

This might not happen if you never update any old time entries(?)

Changed in openobject-addons:
status: New → Confirmed
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

It has been fixed by revision 2768 <email address hidden>.
Thanks.

Changed in openobject-addons:
importance: Undecided → Low
milestone: none → 5.0.12
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.