Fail to create/modifiy a task if project_id is empty

Bug #1333639 reported by Sébastien BEAU - http://www.akretion.com
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
HR - Timesheet Management
Fix Released
Undecided
Sébastien BEAU - http://www.akretion.com

Bug Description

Creating/Updating a task without a project_id will generate an error.

I think for that case code is better than explication

   def _store_set_values(self, cr, uid, ids, fields, context=None):
        # Hack to avoid redefining most of function fields of project.project model
        # This is mainly due to the fact that orm _store_set_values use direct access to database.
        # So when modifiy aa line the _store_set_values as it uses cursor directly to update tasks
        # project triggers on task are not called
        res = super(ProjectTask, self)._store_set_values(cr, uid, ids, fields, context=context)
        for row in self.browse(cr, SUPERUSER_ID, ids, context=context):
            if row.project_id:
                project = row.project_id <<<<<< Here the value can be a null browse record
                project.write({'parent_id': project.parent_id.id}) <<<<<<<<<< AttributeError: 'NoneType' object has no attribute 'id'
        return res

We just have to test if the project_id is null.

Related branches

Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

Sorry It was fix with the merge of "Pedro Manuel Baeza".
It's crazy how bug are fix so quickly ;)

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.