timesheet don't get updated as I feed a task with new works

Bug #949078 reported by Valentin Lab
46
This bug affects 8 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Committed
Medium
OpenERP Publisher's Warranty Team
OpenERP Community Backports (Addons)
Status tracked in 7.0
7.0
New
Undecided
Unassigned
Therp Backports (Deprecated)
Status tracked in Addons-6.1
Addons-6.1
Fix Released
Undecided
Unassigned

Bug Description

I've installed 'hr_timesheet_sheet' and 'project_timesheet'.
I am working with "6.1.0" and "6.1.1" revision of all three components (openerp-web, openobject-server, openobject-addons)

Feeding a task (project.task) with work lines (project.task.work) won't update the "My timesheet" form view.

I'm expecting to see these work lines to be displayed in the "My timesheet" as I add them in the "project.task" form.

To be more specific: I'm expecting to see them in the one2many tree view of field 'timesheet_ids' of the "My timesheet" form.

They seem to be collected correctly (and thus displayed in "My timesheet") at the timesheet creation time. But not after.

A way to get them to be correctly gathered in "My timesheet" is to go in the "Timesheet lines" where they are displayed. Then edit the line that was not reported in "My timesheet", and force the "form" view, then use the calendar widget to select the same date. Then press on "save". The line of work will now be correctly gathered in the "My timesheet".

MY DIAGNOSIS ATTEMPT:

I've digged deeply to try to diagnose the issue. And these are my conclusions:
- The table 'hr_analytic_timesheet' have a 'sheet_id' column which relates to the 'sheet_id' stored function declared in hr_timesheet_sheet/hr_timesheet_sheet.py
- this function is not pre-calculated (and thus the 'sheet_id' value is not set) at 'project.task.work' creation time.
- when rendering the "My timesheet" form view, a '.search' is performed to filter out lines from the 'hr_analytic_timesheet' based on the 'sheet_id' value (based on the sheet_id column table value...)
- A '.read' is then performed on remaining ids, which will trigger the 'sheet_id' calculation, but only on lines that had already the correct 'sheet_id' valuated and stored.

PROPOSITIONS:

Solutions can be found, but they would be different depending on what behavior we'd like to get (of which i'm not aware):
1 - should this be set at write time ? (ie: upon "create" of project.task.work)
2 - should this be set at read time ? (ie: in "get()" of "one2many_mod")

Tags: maintenance

Related branches

Revision history for this message
Ravish(OpenERP) (rmu-openerp) wrote :

Hello Valentin,

I have checked your issue . According to your #comment 1:: "To be more specific": I'm expecting to see them in the one2many tree view of field 'timesheet_ids' of the "My timesheet" form.

It's working fine and collected correctly at my end.For your more reference ,I have attached video .Please take a look.

As you have ask in PROPOSITIONS Portion :: This is set at write time in "project.task.work" at line no 157 in write method .Due to this write method when you save time-sheet then and then you will see project. task.work (Task) in time sheet line.

Hope this will help you!!

Thanks!!

Changed in openobject-addons:
status: New → Incomplete
Revision history for this message
Valentin Lab (vaab) wrote :

Hi,

You must have been mistaken, but I'm speaking of ".create()" of "project.task.work"... It writes in project_timesheet/project_timesheet.py:112 as of revision tagged 6.1.1

      timeline_id = obj_timesheet.create(cr, uid, vals=vals_line, context=context)

Which writes the line with id=2 in the SQL 'hr_analytic_timesheet' table:

lp_hrtimesheet=# select * from hr_analytic_timesheet;
 id | create_uid | create_date | write_date | write_uid | line_id | partner_id | sheet_id
----+------------+----------------------------+----------------------------+-----------+---------+------------+----------
  2 | 1 | 2012-03-13 10:08:03.123667 | 2012-03-13 10:08:03.123667 | 1 | 2 | |
  1 | 1 | 2012-03-13 10:06:59.523923 | 2012-03-13 10:08:03.123667 | 1 | 1 | | 1

You can observe that sheet_id is not pre-calculated as a storage for function field "sheet_id".

Thus, at ".search()" time, when displaying the "My Timesheet" form, it cannot be displayed as expected.

Please consult my video to see a reproduction of the bug from scratch.

Changed in openobject-addons:
status: Incomplete → Confirmed
importance: Undecided → Medium
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
Changed in openobject-addons:
assignee: OpenERP R&D Addons Team 3 (openerp-dev-addons3) → OpenERP Publisher's Warranty Team (openerp-opw)
tags: added: maintenance
Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Somesh Khare (somesh.khare) wrote :

Hello Valentin,

it has been fixed in lp:~openerp-dev/openobject-addons/6.1-opw-573090-skh with,

Revision ID: <email address hidden>
Rev-no: 6707

This branch is under the review of our experts and will be merged soon with stable 6.1 branch.

Thanks

Changed in openobject-addons:
status: In Progress → Fix Committed
Revision history for this message
Jos De Graeve - http://www.apertoso.be/ (jos-degraeve) wrote :

Hello

I have just spent two days trying to figure out why my timesheets did not work like i expected them to.

To realize there was a fix, but it has been committed because whatever reason is quite painfull.

Can somebody explain me the rationale for this ???

The patch from Somesh did fix my issue.

Tnx,

Changed in openobject-addons:
status: Fix Committed → Fix Released
Revision history for this message
Bruno Monero (bruno-monero) wrote :

Hi,

Please some admin change back with Fix Commited status because I switched unintentionally. My bad.

Tnx,

Changed in openobject-addons:
status: Fix Released → Fix Committed
Changed in therp-backports:
milestone: none → 6.1-maintenance
Changed in therp-backports:
status: New → Fix Released
Lara (Therp) (lfreeke)
Changed in therp-backports:
milestone: 6.1-maintenance → 7.0-maintenance
no longer affects: therp-backports/addons-7.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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