From 14d7e20def0ca7872acf4b93906a4fd5857f25da Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 9 Oct 2015 18:57:46 +0200 Subject: [PATCH] [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 --- addons/project/project.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/project/project.py b/addons/project/project.py index c674034b367..e381e624c19 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -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):