* Reword tasks in the sample project * Add a "Create and Edit" button on the project creation modal * Open the file chooser in "Set a cover image" if there are no images set * Correclty display the kanban state button on archived task * Add a button to list the tasks when deleting a project * Open file chooser for cover image: Automatically open the file chooser when setting a cover image on a task if there are no attachments to chose from. closes odoo/odoo#47306 Taskid: 2209133 Related: odoo/enterprise#9141 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
25 lines
887 B
Python
25 lines
887 B
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')
|
|
|
|
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})
|
|
return self.env.ref('project.open_view_project_all').read()[0]
|
|
|
|
def confirm_delete(self):
|
|
self.with_context(active_test=False).project_ids.unlink()
|
|
return self.env.ref('project.open_view_project_all').read()[0]
|