diff --git a/addons_extensions/project_task_timesheet_extended/models/project_task.py b/addons_extensions/project_task_timesheet_extended/models/project_task.py index 28c173e88..ae3b79e44 100644 --- a/addons_extensions/project_task_timesheet_extended/models/project_task.py +++ b/addons_extensions/project_task_timesheet_extended/models/project_task.py @@ -46,7 +46,7 @@ class projectTask(models.Model): ('normal', 'Normal'), ], compute='_compute_deadline_status') - model_id = fields.Many2one('project.module.source', string="Module", related='project_id.module_id', store=True, readonly=True) + model_id = fields.Many2one('project.module.source', string="Module", store=True, readonly=True) task_display_id = fields.Char(string="Task ID", compute="_compute_kanban_display_fields", compute_sudo=True) module_display_name = fields.Char(string="Module", compute="_compute_kanban_display_fields", compute_sudo=True) allocation_start_date = fields.Date(string="Allocation Start Date") @@ -54,11 +54,11 @@ class projectTask(models.Model): reassignment_history = fields.Html(string="Reassignment History", readonly=True) - @api.depends('sequence_name', 'project_id', 'project_id.module_id', 'project_id.module_id.name', 'model_id', 'model_id.name') + @api.depends('sequence_name', 'project_id', 'model_id', 'model_id.name') def _compute_kanban_display_fields(self): for task in self: task.task_display_id = task.sequence_name or ("TASK-%03d" % task.id if task.id else "New Task") - module = task.model_id or task.project_id.module_id + module = task.model_id task.module_display_name = module.name if module else "No Module" @api.depends('date_deadline') @@ -841,7 +841,7 @@ class projectTask(models.Model): task.stage_id = n_stage task.approval_status = "approved" - activity_log = "%s: ✅ approved by %s and moved to %s" % ( + activity_log = "%s: approved by %s and moved to %s" % ( current_stage.name, self.env.user.employee_id.name, n_stage.name) @@ -849,7 +849,7 @@ class projectTask(models.Model): # Use the helper method to add activity log task._add_activity_log(activity_log) - user_notes = "%s: ✅ moved to %s and awaiting your completion" % ( + user_notes = "%s: moved to %s and awaiting your completion" % ( task.sequence_name, n_stage.name ) @@ -882,9 +882,9 @@ class projectTask(models.Model): ) else: task.approval_status = "approved" - notes = "%s: ✅ Task approved and completed by %s" % (task.sequence_name, self.env.user.employee_id.name) + notes = "%s: Task approved and completed by %s" % (task.sequence_name, self.env.user.employee_id.name) - activity_log = "%s: ✅ approved by %s" % ( + activity_log = "%s: approved by %s" % ( current_stage.name, self.env.user.employee_id.name) @@ -920,9 +920,9 @@ class projectTask(models.Model): # Optional: find previous stage if you want to send back stage = task.assignees_timelines.filtered(lambda s: s.stage_id == task.stage_id) - notes = "%s: âÂÂÂÂÅ’ %s rejected by %s" % (task.sequence_name, current_stage.name, self.env.user.employee_id.name) + notes = "%s: %s rejected by %s" % (task.sequence_name, current_stage.name, self.env.user.employee_id.name) - activity_log = "%s: âÂÂÂÂÅ’ rejected by %s: %s" % ( + activity_log = "%s: rejected by %s: %s" % ( current_stage.name, self.env.user.employee_id.name, reason) diff --git a/addons_extensions/project_task_timesheet_extended/view/project_by_module.xml b/addons_extensions/project_task_timesheet_extended/view/project_by_module.xml index c2183fdd4..cdd953ecd 100644 --- a/addons_extensions/project_task_timesheet_extended/view/project_by_module.xml +++ b/addons_extensions/project_task_timesheet_extended/view/project_by_module.xml @@ -1,49 +1,6 @@ - - project.project.form.module.inherit - project.project - - - - - - - - - - project.project.search.project.by.module - project.project - - - - - - - - - - Project by Module - project.project - kanban,list,form,calendar,activity - - {'search_default_group_by_module': 1} - - - No projects found. - - - Create projects and set their Module to review projects module-wise. - - - - - project.project.kanban.portfolio.inherit @@ -79,6 +36,41 @@ + + + project.task.search.project.by.module + project.task + + + + + + + + + + + + Project by Module + project.task + kanban,list,form,calendar,activity + + {'search_default_group_by_module': 1} + + + No projects found. + + + Create projects and set their Module to review projects module-wise. + + + + + diff --git a/addons_extensions/project_task_timesheet_extended/view/project_task.xml b/addons_extensions/project_task_timesheet_extended/view/project_task.xml index c56a36292..3cb84e356 100644 --- a/addons_extensions/project_task_timesheet_extended/view/project_task.xml +++ b/addons_extensions/project_task_timesheet_extended/view/project_task.xml @@ -24,13 +24,13 @@ THIS TASK IS CURRENTLY PAUSED - - - - - - - + + + + + + + @@ -61,12 +61,12 @@ - - - - - - + + + + + + @@ -95,8 +95,8 @@ - - + + @@ -207,10 +207,10 @@ ['|', ('user_ids', 'in', uid), ('involved_user_ids', 'in', uid)] - - - - + + + + @@ -241,58 +241,59 @@ - - - project.task.kanban.task.id.module.my.tasks - project.task - - primary - 80 - - - - - - - - - - project.task.kanban.task.id.module.all.tasks - project.task - - primary - 80 - - - - - - - - - - project.task.kanban.task.id.module.project.tasks - project.task - - primary - 80 - - - - - - - - - - - - - - - - + + + project.task.kanban.task.id.module.my.tasks + project.task + + primary + 80 + + + + + + + + + project.task.kanban.task.id.module.all.tasks + project.task + + primary + 80 + + + + + + + + + + project.task.kanban.task.id.module.project.tasks + project.task + + primary + 80 + + + + + + + + + + + + + + + + + + diff --git a/addons_extensions/project_task_timesheet_extended/wizards/task_reject_reason_wizard.py b/addons_extensions/project_task_timesheet_extended/wizards/task_reject_reason_wizard.py index a1871758c..e770eb2d5 100644 --- a/addons_extensions/project_task_timesheet_extended/wizards/task_reject_reason_wizard.py +++ b/addons_extensions/project_task_timesheet_extended/wizards/task_reject_reason_wizard.py @@ -8,7 +8,8 @@ class TaskRejectReasonWizard(models.TransientModel): reason = fields.Text(string="Rejection Reason", required=True) task_id = fields.Many2one("project.task", string="Task", required=True) - stage_id = fields.Many2one("project.task.type", string="Return To Stage", required=True) + return_to_previous_stages = fields.Boolean(default=False) + stage_id = fields.Many2one("project.task.type", string="Return To Stage",) available_stage_ids = fields.Many2many("project.task.type", compute="_compute_available_stage_ids") @api.depends("task_id", "task_id.project_id", "task_id.stage_id") @@ -16,17 +17,20 @@ class TaskRejectReasonWizard(models.TransientModel): for wizard in self: stages = wizard.task_id.project_id.type_ids if wizard.task_id.stage_id: - stages = stages.filtered(lambda s: s.id != wizard.task_id.stage_id.id) + stages = stages.filtered(lambda s: s.id != wizard.task_id.stage_id.id and s.sequence < wizard.task_id.stage_id.sequence) wizard.available_stage_ids = [(6, 0, stages.ids)] def action_reject(self): self.ensure_one() if not self.reason: raise UserError(_("Please enter a reason for rejection.")) - if not self.stage_id: + if not self.stage_id and self.return_to_previous_stages: raise UserError(_("Please select the stage where the task should be returned.")) - self.task_id.reject_and_return(reason=self.reason, return_stage=self.stage_id) + if self.return_to_previous_stages: + self.task_id.reject_and_return(reason=self.reason, return_stage=self.stage_id) + else: + self.task_id.reject_and_return(reason=self.reason) return {"type": "ir.actions.act_window_close"} @@ -84,7 +88,7 @@ class TaskRequestTimelinesWizard(models.TransientModel): values["line_ids"] = [ (0, 0, { "stage_id": line.stage_id.id, - "responsible_user_id": line.responsible_lead.id, + "responsible_user_id": line.responsible_lead.id, "user_ids": [(6, 0, line.assigned_to.ids)], }) for line in task.assignees_timelines.sorted(lambda l: l.stage_sequence) @@ -109,7 +113,7 @@ class TaskRequestTimelinesWizardLine(models.TransientModel): wizard_id = fields.Many2one("task.request.timelines.wizard", required=True, ondelete="cascade") task_id = fields.Many2one(related="wizard_id.task_id", store=False) stage_id = fields.Many2one("project.task.type", string="Stage") - responsible_user_id = fields.Many2one("res.users", string="Responsible User") + responsible_user_id = fields.Many2one("res.users", string="Responsible User") user_ids = fields.Many2many("res.users", string="Assignees") available_user_ids = fields.Many2many("res.users", compute="_compute_available_user_ids") @@ -215,4 +219,4 @@ class TaskReassignAssigneesWizardLine(models.TransientModel): users |= line.stage_id.team_id.all_members_ids if line.task_id.project_id: users |= line.task_id.project_id.members_ids | line.task_id.project_id.user_id | line.task_id.project_id.project_lead - line.available_user_ids = [(6, 0, users.filtered(lambda u: not u.share).ids)] + line.available_user_ids = [(6, 0, users.filtered(lambda u: not u.share).ids)] diff --git a/addons_extensions/project_task_timesheet_extended/wizards/task_reject_reason_wizard.xml b/addons_extensions/project_task_timesheet_extended/wizards/task_reject_reason_wizard.xml index 8cd260de3..855ce3bd1 100644 --- a/addons_extensions/project_task_timesheet_extended/wizards/task_reject_reason_wizard.xml +++ b/addons_extensions/project_task_timesheet_extended/wizards/task_reject_reason_wizard.xml @@ -9,7 +9,8 @@ - + + - +
- No projects found. -
- Create projects and set their Module to review projects module-wise. -
+ No projects found. +
+ Create projects and set their Module to review projects module-wise. +