working hours timesheet entree incorrectly passes ID to _on_change_ methods when creating a new line

Bug #439596 reported by EdZ
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Web Client
Fix Released
Medium
Amit Mendapara

Bug Description

In HR / Working Hours when adding a new line for timesheet entree using the web client, the last ID of table hr_analytic_line is passed to the on_change_ methods of the object. Consequently code in on_change_ methods that depends on the IDS parameter to be empty when creating a new line doesn't execute correctly.

consider the code below from my inherited hr.analytic.timesheet

def on_change_task_id(self, cr, uid, ids, nTaskId, cName, nAccountId):
        # Get the values for the linked project: project code and description
        if not nTaskId:
            nTaskId = 0

        # Get stored task_id
        nTaskIdOld = 0
        context = {}
        oTimeSheetLine = self.pool.get('hr.analytic.d2e_timesheet').read(cr, uid, ids, ['task_id',], context)
        if len(oTimeSheetLine) > 0:
            tplTaskIdOld = oTimeSheetLine[0]["task_id"]
            if tplTaskIdOld :
                nTaskIdOld = tplTaskIdOld[0]

            if not nTaskIdOld :
                nTaskIdOld = 0

        # Update project fields if task_id has changed
        if nTaskId <> nTaskIdOld :

The last line incorrectly returns true because nTaskIdOld contains an incorrect value.

Related branches

Revision history for this message
Amit Mendapara (cristatus) wrote :

may be duplicate of bug lp:439438

Changed in openobject-client-web:
status: New → Incomplete
Revision history for this message
EdZ (e-dousi) wrote :

I don't know why the client crashes in bug 439438
What I do know is that, when I step through my code creating a new line I can see it passed the last stored record id in the IDS parameter of on_change, which is unexpected because the new record has not been stored/commited to postgres yet.

Changed in openobject-client-web:
assignee: nobody → ame (Tiny) (ame-tiny)
importance: Undecided → Medium
milestone: none → 5.0.7
status: Incomplete → Confirmed
Revision history for this message
Amit Mendapara (cristatus) wrote :

Fixed in rev 2707. Branch 5.0. Please don't forget to reload your browser cache after update.

Changed in openobject-client-web:
status: Confirmed → Fix Committed
Changed in openobject-client-web:
status: Fix Committed → 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.