Files
odoo_source/addons/project/wizard/project_delete_wizard.py
T
William Braeckman 25f8554426 [IMP] project: add project stages
Adds new optional stages for the project.project model.

Previously projects would stay dormant when they were finished, we can
now define stages for those projects to determine where a stage is in
it's lifecycle.

Also adds some small changes to the project itself, such as adding tags.

Closes odoo/odoo#73648

Task ID: 2581575

Related: odoo/upgrade#2646
Signed-off-by: LTU-Odoo <IT-Ideas@users.noreply.github.com>
2021-08-23 07:45:56 +00:00

29 lines
1.1 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class ProjectDelete(models.TransientModel):
_name = 'project.delete.wizard'
_description = 'Project Delete Wizard'
project_ids = fields.Many2many('project.project', string='Projects')
task_count = fields.Integer(compute='_compute_task_count')
projects_archived = fields.Boolean(compute='_compute_projects_archived')
def _compute_projects_archived(self):
for wizard in self.with_context(active_test=False):
wizard.projects_archived = all(not p.active for p in wizard.project_ids)
def _compute_task_count(self):
for wizard in self:
wizard.task_count = sum(wizard.with_context(active_test=False).project_ids.mapped('task_count'))
def action_archive(self):
self.project_ids.write({'active': False})
def confirm_delete(self):
self.with_context(active_test=False).project_ids.unlink()
return self.env["project.project"]._action_open_all_projects()