From b0da2f59c9fba3415fb9b25e4c9b41e035787c73 Mon Sep 17 00:00:00 2001 From: Leo Pinedo Date: Tue, 4 Oct 2022 23:22:18 +0000 Subject: [PATCH] [WIP] project_acceptance: change on mail template and controllers button H11043 --- project_acceptance/__manifest__.py | 6 ++-- project_acceptance/controllers/portal.py | 4 +-- .../data/mail_template_data.xml | 28 ++++++++++++++++--- .../project_exception_data.xml} | 3 +- project_acceptance/models/project.py | 2 +- 5 files changed, 32 insertions(+), 11 deletions(-) rename project_acceptance/{security/project_acceptance_security.xml => data/project_exception_data.xml} (67%) diff --git a/project_acceptance/__manifest__.py b/project_acceptance/__manifest__.py index 4a198a2a..a443ce31 100644 --- a/project_acceptance/__manifest__.py +++ b/project_acceptance/__manifest__.py @@ -8,14 +8,14 @@ 'complexity': 'easy', 'description': """ """, 'depends': [ - 'project', + # 'project', 'project_exception', ], 'data': [ 'data/mail_template_data.xml', + 'data/project_exception_data.xml', # 'report/project_report.xml', - # 'report/project_report_template.xml', - 'security/project_acceptance_security.xml', + # 'report/project_report_template.xml', 'views/project_portal_templates.xml', 'views/project_views.xml', ], diff --git a/project_acceptance/controllers/portal.py b/project_acceptance/controllers/portal.py index ef5fdf15..03497725 100644 --- a/project_acceptance/controllers/portal.py +++ b/project_acceptance/controllers/portal.py @@ -15,13 +15,13 @@ class CustomerPortal(portal.CustomerPortal): def portal_task_accept(self, task_id, access_token=None, **post): if request.httprequest.method == 'POST': task = request.env['project.task'].browse([task_id]) - task.task_acceptance = 'accept' + task.sudo().task_acceptance = 'accept' @http.route(['/my/task//decline'], type='http', auth="user", website=True) def portal_task_decline(self, task_id, access_token=None, **post): if request.httprequest.method == 'POST': task = request.env['project.task'].browse([task_id]) - task.task_acceptance = 'decline' + task.sudo().task_acceptance = 'decline' # @http.route(['/my/task//feedback'], type='http', auth="user", website=True) # def portal_task_feedback(self, task_id, access_token=None, **post): diff --git a/project_acceptance/data/mail_template_data.xml b/project_acceptance/data/mail_template_data.xml index 69f719b6..30e5ada6 100644 --- a/project_acceptance/data/mail_template_data.xml +++ b/project_acceptance/data/mail_template_data.xml @@ -25,21 +25,22 @@ + + + Please click on to go to the portal and confirm your selection
+ + +
- Please click on one of the below icons to indicate approval.
+ + Please click on one of the below icons to go back to the portal and can confirm your selection.
@@ -47,6 +48,25 @@
- + Accepted - + Declined - + Feedback
+ + + Go to the portal + +
+
+ --> + + + This task will remain in the "" until the task is approved or declined. diff --git a/project_acceptance/security/project_acceptance_security.xml b/project_acceptance/data/project_exception_data.xml similarity index 67% rename from project_acceptance/security/project_acceptance_security.xml rename to project_acceptance/data/project_exception_data.xml index 81a29683..da03b7e8 100644 --- a/project_acceptance/security/project_acceptance_security.xml +++ b/project_acceptance/data/project_exception_data.xml @@ -7,7 +7,8 @@ When task stage changes and requires acceptance and task acceptance is blank 50 project.task - if not task.task_acceptance and task.stage_id.requires_acceptance: failed=True + + failed = not task.task_acceptance and task.stage_id.requires_acceptance diff --git a/project_acceptance/models/project.py b/project_acceptance/models/project.py index b01f461f..c13825b3 100644 --- a/project_acceptance/models/project.py +++ b/project_acceptance/models/project.py @@ -3,7 +3,7 @@ from odoo import api, fields, models class Task(models.Model): _inherit = 'project.task' - task_acceptance = fields.Selection([('accept', 'Accepted'), ('decline', 'Decline'), ('feedback', 'Feedback Provided')],'Task Acceptance', traking=True) + task_acceptance = fields.Selection([('accept', 'Accepted'), ('decline', 'Decline'), ('feedback', 'Feedback Provided')],'Task Acceptance', tracking=True) class ProjectTaskType(models.Model):