[FIX] project: don't copy remaining hours when duplicating tasks

Since we're not duplicating work items when duplicating tasks during
project duplication, it doesn't make sense to duplicate the
likely correspondingly adjusted remaining hour.

Behave as if the planned hours had just been set/reset and set the
remaining hours of the new task to that instead.

fixes #8985
This commit is contained in:
Xavier Morel 2015-10-09 18:57:46 +02:00
parent 617ba72a9d
commit 14d7e20def
1 changed files with 4 additions and 1 deletions

View File

@ -698,9 +698,12 @@ class task(osv.osv):
def copy_data(self, cr, uid, id, default=None, context=None):
if default is None:
default = {}
current = self.browse(cr, uid, id, context=context)
if not default.get('name'):
current = self.browse(cr, uid, id, context=context)
default['name'] = _("%s (copy)") % current.name
if 'remaining_hours' not in default:
default['remaining_hours'] = current.planned_hours
return super(task, self).copy_data(cr, uid, id, default, context)
def _is_template(self, cr, uid, ids, field_name, arg, context=None):