[FIX] project: archive project

Archive the associated analytic account when a project is archived. Once
a porject is archived, it is assumed that we don't want to use the
analytic account anymore.

Moreover, it might be tempting for a user to delete these "useless"
analytic accounts, and therefore it would delete the archived projects
and tasks without notification.

Closes #21224
opw-784685
This commit is contained in:
Nicolas Martinelli
2017-12-04 13:57:50 +01:00
committed by Nicolas Martinelli
parent 8b875e4dd4
commit 055f8e0fcd
+2
View File
@@ -264,6 +264,8 @@ class Project(models.Model):
if 'active' in vals:
# archiving/unarchiving a project does it on its tasks, too
self.with_context(active_test=False).mapped('tasks').write({'active': vals['active']})
# archiving/unarchiving a project implies that we don't want to use the analytic account anymore
self.with_context(active_test=False).mapped('analytic_account_id').write({'active': vals['active']})
return res
@api.multi