← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 798190] Re: hr_timesheet_sheet: can not write attendance

 

Ok, I just got the exception with the _check function in the
hr_timesheet_sheet again and this time it is the method unlink of
inherited hr.attendance in hr_timesheet_sheet which also calls _check.

_check is imho deprecated anyway because there is a constraint in the
inherited class hr_timesheet_line which checks the state.

Here is my inherited (hr.attendance) def and the exception:

    def unlink(self, cr, uid, ids, context=None):
        if context == None:
            context = {}
        context['handling'] = 'delete'
        context['hint'] = '\n\nPlease delete the task work first!'
        self.check_linked_work (cr, uid, ids, context=context)
        
        return super(hr_attendance,self).unlink(cr, uid, ids, context=context)

[2011-06-22 11:29:32,382][?] WARNING:browse_record:[01]: Field '0' does not exist in object 'browse_record(hr.attendance, 206)':
[2011-06-22 11:29:32,382][?] WARNING:browse_record:[02]: None
[2011-06-22 11:29:32,383][?] ERROR:web-services:Uncaught exception
Traceback (most recent call last):
  File "/data/launchpad/openobject-server/trunk/openerp/osv/osv.py", line 120, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/data/launchpad/openobject-server/trunk/openerp/osv/osv.py", line 174, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/data/launchpad/openobject-server/trunk/openerp/osv/osv.py", line 165, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/current/server/addons/project_timesheet/project_timesheet.py", line 185, in unlink
    self.pool.get('project.task.work').unlink(cr, uid, work_ids, *args, **kwargs)
  File "/current/server/addons/hr_project/hr_project.py", line 241, in unlink
    attendance_obj.unlink(cr, uid, start_id)
  File "/current/server/addons/hr_project/hr_project.py", line 407, in unlink
    return super(hr_attendance,self).unlink(cr, uid, ids, context=context)
  File "/current/server/addons/hr_timesheet_sheet/hr_timesheet_sheet.py", line 622, in unlink
    self._check(cr, uid, ids)
  File "/current/server/addons/hr_timesheet_sheet/hr_timesheet_sheet.py", line 638, in _check
    for att in self.browse(cr, uid, ids):
  File "/data/launchpad/openobject-server/trunk/openerp/osv/orm.py", line 223, in __getitem__
    name, self))
KeyError: "Field '0' does not exist in object 'browse_record(hr.attendance, 206)'"

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/798190

Title:
  hr_timesheet_sheet: can not write attendance

Status in OpenERP Modules (addons):
  Incomplete

Bug description:
  Exception is thrown when there is no sheet_id linked

      def write(self, cr, uid, ids, vals, context=None):
          if context is None:
              context = {}
          self._check(cr, uid, ids) <-- exception
          res = super(hr_attendance,self).write(cr, uid, ids, vals, context=context)
          .
          .
          .

  _check should be adapted like other methods

      def _check(self, cr, uid, ids, context=None):
          if context is None:
              context = {}
          if 'sheet_id' in context:
              for att in self.browse(cr, uid, ids, context=context):
                  if att.sheet_id and att.sheet_id.state not in ('draft', 'new'):
                      raise osv.except_osv(_('Error !'), _('You cannot modify an entry in a confirmed timesheet !'))
          return True

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/798190/+subscriptions


References