Crash with ' "NoneType" object is not iterable'

Bug #1174747 reported by Julian Isaac
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openerp-hr-attendance-analysis
New
Undecided
Unassigned

Bug Description

OpenERP-Client Version : 6.0.4
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
  File "/usr/share/pyshared/openerp-server/netsvc.py", line 489, in dispatch
    result = ExportService.getService(service_name).dispatch(method, auth, params)
  File "/usr/share/pyshared/openerp-server/service/web_services.py", line 636, in dispatch
    res = fn(db, uid, *params)
  File "/usr/share/pyshared/openerp-server/service/web_services.py", line 663, in exp_execute
    return self._execute(db, uid, wiz_id, datas, action, context)
  File "/usr/share/pyshared/openerp-server/service/web_services.py", line 645, in _execute
    return wiz.execute(db, uid, self.wiz_datas[wiz_id], action, context)
  File "/usr/share/pyshared/openerp-server/wizard/__init__.py", line 177, in execute
    res = self.execute_cr(cr, uid, data, state, context)
  File "/usr/share/pyshared/openerp-server/wizard/__init__.py", line 72, in execute_cr
    action_res = action(self, cr, uid, data, context)
  File "/usr/share/pyshared/openerp-server/addons/hr_attendance_analysis/wizard/process.py", line 82, in _process
    count = pool.get('hr.aa.journal').build(cr, uid, time_start, tu.dt2s(tu.datetime.today()), context=context)
  File "/usr/share/pyshared/openerp-server/addons/hr_attendance_analysis/hr_journal.py", line 733, in build
    con.turn_id.attendance_ids ]
TypeError: 'NoneType' object is not iterable

Revision history for this message
Julian Isaac (78luphr0rnk2nuqimstywepozxn9kl19tqh0tx66b5dki1xxsh5mkz9gl21a5rlwfnr8jn6ln0m3jxne2k9x1ohg85w3jabxlrqbgszpjpwcmvkbcvq9spp-o9l3h2n6n-a811i2i3ytqlsztthjth0svbccw8inm65tmkqp9sarr553jq53in4xm1m8wn3o4rlwaer06ogwvqwv9mrqoku2x334n7di44o65qze67n1wneepmidnuwnd) wrote :

In hr_journal.py, prior to line 733, add a check for None against con.turn_id.attendance_ids before trying to iterate over it?

Revision history for this message
Julian Isaac (78luphr0rnk2nuqimstywepozxn9kl19tqh0tx66b5dki1xxsh5mkz9gl21a5rlwfnr8jn6ln0m3jxne2k9x1ohg85w3jabxlrqbgszpjpwcmvkbcvq9spp-o9l3h2n6n-a811i2i3ytqlsztthjth0svbccw8inm65tmkqp9sarr553jq53in4xm1m8wn3o4rlwaer06ogwvqwv9mrqoku2x334n7di44o65qze67n1wneepmidnuwnd) wrote :

In hr_journal.py, add import:

from osv.orm import except_orm

At line 729:

            for (emp_id, con_id) in con_ids.items():
                emp = emp_pool.browse(cr, uid, emp_id, context=context)
                con = con_pool.browse(cr, uid, con_id, context=context)
                if con.turn_id.attendance_ids is None:
                    raise except_orm('No attendances', 'No attendance ids found')
                contract_hours = (
                    str(time.weekday()) in [ ts.dayofweek for ts in
                                                con.turn_id.attendance_ids ]
                    ) * con.working_hours_per_day

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.