[WIP] project_acceptance: change on mail template and controllers button

H11043
This commit is contained in:
Leo Pinedo
2022-10-04 23:22:18 +00:00
parent b2c83cc404
commit b0da2f59c9
5 changed files with 32 additions and 11 deletions

View File

@@ -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',
],

View File

@@ -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/<int:task_id>/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/<int:task_id>/feedback'], type='http', auth="user", website=True)
# def portal_task_feedback(self, task_id, access_token=None, **post):

View File

@@ -25,21 +25,22 @@
<tr><td style="text-align: center;">
<table border="0" cellpadding="0" cellspacing="0" width="590" summary="o_mail_notification" style="width:100%; margin: 32px 0px 32px 0px;">
<tr><td style="font-size: 13px;">
<strong>Please click on one of the below icons to indicate approval.</strong><br/>
<!-- <strong>Please click on one of the below icons to indicate approval.</strong><br/> -->
<strong>Please click on one of the below icons to go back to the portal and can confirm your selection.</strong><br/>
</td></tr>
<tr><td style="font-size: 13px;">
<table style="width:100%;text-align:center;margin-top:2rem;">
<tr>
<td>
<a role="button" class="btn btn-primary" t-attf-href="/my/task/#{task.id}/accept" style="color: #ffffff">
<a role="button" class="btn btn-primary" t-attf-href="{{object.get_base_url()}}/my/task/{{object.id}}" style="color: #ffffff">
<i class="fa fa-check"/> Accepted</a>
</td>
<td>
<a role="button" class="btn btn-danger" t-attf-href="/my/task/#{task.id}/decline" style="color: #ffffff">
<a role="button" class="btn btn-danger" t-attf-href="{{object.get_base_url()}}/my/task/{{object.id}}" style="color: #ffffff">
<i class="fa fa-stop-circle"/> Declined</a>
</td>
<td>
<a role="button" class="btn btn-warning" t-attf-href="/my/task/#{task.id}/feedback" style="color: #ffffff">
<a role="button" class="btn btn-warning" t-attf-href="{{object.get_base_url()}}/my/task/{{object.id}}/#discussion" style="color: #ffffff">
<i class="fa fa-comment"/> Feedback</a>
</td>
</tr>
@@ -47,6 +48,25 @@
</td></tr>
</table>
</td></tr>
<!-- <tr><td style="text-align: center;">
<table border="0" cellpadding="0" cellspacing="0" width="590" summary="o_mail_notification" style="width:100%; margin: 32px 0px 32px 0px;">
<tr><td style="font-size: 13px;">
<!-- <strong>Please click on one of the below icons to indicate approval.</strong><br/> -->
<strong>Please click on to go to the portal and confirm your selection</strong><br/>
</td></tr>
<tr><td style="font-size: 13px;">
<table style="width:100%;text-align:center;margin-top:2rem;">
<tr>
<a role="button" class="btn btn-primary" t-attf-href="{{object.get_base_url()}}/my/task/{{object.id}}" style="color: #ffffff"> Go to the portal</a>
</tr>
</table>
</td></tr>
</table>
</td></tr> -->
<tr><td valign="top" style="font-size: 13px;">
This task will remain in the "<strong t-out="object.stage_id.name"></strong>" until the task is approved or declined.
<t t-if="object.project_id.rating_status == 'stage'">

View File

@@ -7,7 +7,8 @@
<field name="description">When task stage changes and requires acceptance and task acceptance is blank</field>
<field name="sequence">50</field>
<field name="model">project.task</field>
<field name="code">if not task.task_acceptance and task.stage_id.requires_acceptance: failed=True</field>
<!-- <field name="code">if not task.task_acceptance and task.stage_id.requires_acceptance: failed=True</field> -->
<field name="code">failed = not task.task_acceptance and task.stage_id.requires_acceptance</field>
<field name="active" eval="False"/>
</record>

View File

@@ -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):