[7.0] timesheet_task - 'NoneType' object has no attribute error when assigning to an invoice analytic lines having task without projects

Bug #1219825 reported by Yannick Vaucher @ Camptocamp
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
HR - Timesheet Management
New
Undecided
Unassigned

Bug Description

When associating it to an invoice if one of your analytic line is linked to a task which has no project_id this will raise an AttributeError Exception.

Here comes the traceback:

Server Traceback (most recent call last):
  File "/.../webclient/addons/web/session.py", line 89, in send
    return openerp.netsvc.dispatch_rpc(service_name, method, args)
  File "/.../server/openerp/netsvc.py", line 292, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/.../server/openerp/service/web_services.py", line 626, in dispatch
    res = fn(db, uid, *params)
  File "/.../server/openerp/osv/osv.py", line 188, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/.../server/openerp/osv/osv.py", line 131, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/.../server/openerp/osv/osv.py", line 197, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/.../server/openerp/osv/osv.py", line 185, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/.../common_migrated_modules/project_billing_utils/wizard/associate_aal.py", line 52, in associate_aal
    aal_obj.write(cr, uid, aal_ids, {'invoice_id': current.invoice_id.id}, context=context)
  File "/.../hr-timesheet/timesheet_task/project_task.py", line 211, in write
    return super(AccountAnalyticLine, self).write(cr, uid, ids, vals, context=context)
  File "/.../addons/hr_timesheet_invoice/hr_timesheet_invoice.py", line 131, in write
    context=context)
  File "/.../server/openerp/osv/orm.py", line 4202, in write
    self._validate(cr, user, ids, context)
  File "/.../server/openerp/osv/orm.py", line 1527, in _validate
    if not fun(self, cr, uid, ids):
  File "/.../hr-timesheet/timesheet_task/project_task.py", line 131, in _check_task_project
    if line.task_id.project_id.analytic_account_id.id != line.account_id.id:
AttributeError: 'NoneType' object has no attribute 'id'

description: updated
summary: [7.0] timesheet_task - 'NoneType' object has no attribute error when
- assigning analytic lines having task without projects
+ assigning to an invoice analytic lines having task without projects
description: updated
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.