timesheet_task : Crash when adding timesheet lines on a task

Bug #1297708 reported by Alexis de Lattre
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
HR - Timesheet Management
Fix Released
Undecided
Unassigned

Bug Description

With the module timesheet_task, go to the form view of a task and try to add timesheet lines : it often crashes with this error message :

2014-03-26 08:37:02,754 2695 ERROR erpv70_aven1 openerp.sql_db: Programming error: column "task_id" does not exist
LINE 1: ...lect 1 from hr_analytic_timesheet where id=18 and task_id=11
                                                             ^
, in query select 1 from hr_analytic_timesheet where id=%s and task_id=%s
2014-03-26 08:37:02,755 2695 ERROR erpv70_aven1 openerp.osv.osv: Uncaught exception
Traceback (most recent call last):
  File "/home/alexis/new_boite/dev/server-70/openerp/osv/osv.py", line 132, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/alexis/new_boite/dev/server-70/openerp/osv/osv.py", line 199, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/alexis/new_boite/dev/server-70/openerp/osv/osv.py", line 187, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/alexis/new_boite/dev/hr-timesheet/timesheet_task/project_task.py", line 96, in write
    res = super(ProjectTask, self).write(cr, uid, ids, vals, context=context)
  File "/home/alexis/new_boite/dev/addons-70/project/project.py", line 1202, in write
    result = super(task, self).write(cr, uid, ids, vals, context=context)
  File "/home/alexis/new_boite/dev/addons-70/mail/mail_thread.py", line 290, in write
    result = super(mail_thread, self).write(cr, uid, ids, values, context=context)
  File "/home/alexis/new_boite/dev/server-70/openerp/osv/orm.py", line 4234, in write
    result += self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context) or []
  File "/home/alexis/new_boite/dev/server-70/openerp/osv/fields.py", line 574, in set
    cr.execute("select 1 from {0} where id=%s and {1}=%s".format(_table, self._fields_id), (act[1], id))
  File "/home/alexis/new_boite/dev/server-70/openerp/sql_db.py", line 161, in wrapper
    return f(self, *args, **kwargs)
  File "/home/alexis/new_boite/dev/server-70/openerp/sql_db.py", line 226, in execute
    res = self._obj.execute(query, params)
ProgrammingError: column "task_id" does not exist
LINE 1: ...lect 1 from hr_analytic_timesheet where id=18 and task_id=11
                                                             ^

This crash is not systematic, but it happens very often. I noticed that usually it works for the first timesheet line that you create+save, but it crashes on the next one that you create+save.

There is no field task_id on hr_analytic_timesheet, because hr.analytic.timesheet inherits from account.analytic.line and the field task_id is on account.analytic.line. But OpenERP's ORM tries to read the field 'task_id' on hr_analytic_timesheet instead of account_analytic_line, which make it crash.

Revision history for this message
Alexis de Lattre (alexis-via) wrote :

Here is a step-by-step scenario to reproduce the bug on an up-to-date OCB 7.0 environnement and an up-to-date lp:hr-timesheet branch. I'm using Firefox 28.

1) create a new DB with demo data
2) install the moduletimesheet_task
3) Go to the menu Project > Projects, then select the project "E-learning Integration"
4) Click on the task "Dataflow Design" ; it should bring to to the form view of this task
5) Click on "Edit", then "Add an item" in the one2many widget in the first tab. For this line, enter :
Description : TS test1
Quantity : 12
Click on "Save" -> it works
6) Click on "Edit", then "Add an item". For this new line, enter :
Description : TS test2
Quantity : 24
Click on "Save" -> it crashes with the following backtrace :

  File "/home/alexis/new_boite/dev/hr-timesheet/timesheet_task/project_task.py", line 97, in write
    res = super(ProjectTask, self).write(cr, uid, ids, vals, context=context)
  File "/home/alexis/new_boite/dev/addons-70/project/project.py", line 1203, in write
    result = super(task, self).write(cr, uid, ids, vals, context=context)
  File "/home/alexis/new_boite/dev/addons-70/mail/mail_thread.py", line 291, in write
    result = super(mail_thread, self).write(cr, uid, ids, values, context=context)
  File "/home/alexis/new_boite/dev/server-70/openerp/osv/orm.py", line 4251, in write
    result += self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context) or []
  File "/home/alexis/new_boite/dev/server-70/openerp/osv/fields.py", line 574, in set
    cr.execute("select 1 from {0} where id=%s and {1}=%s".format(_table, self._fields_id), (act[1], id))
  File "/home/alexis/new_boite/dev/server-70/openerp/sql_db.py", line 161, in wrapper
    return f(self, *args, **kwargs)
  File "/home/alexis/new_boite/dev/server-70/openerp/sql_db.py", line 226, in execute
    res = self._obj.execute(query, params)
ProgrammingError: column "task_id" does not exist
LINE 1: ...elect 1 from hr_analytic_timesheet where id=6 and task_id=14

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :
Revision history for this message
Alexis de Lattre (alexis-via) wrote :

Yes, it does ! Thanks Stéphane for spotting this !

Changed in hr-timesheet:
status: New → 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.