mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[IMP] project_acceptance: refactor button on mail template and added header for comment code
H11043
This commit is contained in:
@@ -11,6 +11,7 @@ class PortalChatter(mail.PortalChatter):
|
||||
def portal_chatter_post(self, res_model, res_id, message, attachment_ids='', attachment_tokens='', **kwargs):
|
||||
if request.httprequest.method == 'POST':
|
||||
task = request.env['project.task'].browse([res_id])
|
||||
# task.with_context('skip_detect_exceptions').write({'task_acceptance': 'feedback'})
|
||||
task.sudo().ignore_exception = True
|
||||
task.sudo().task_acceptance = 'feedback'
|
||||
task.sudo().ignore_exception = False
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
# import binascii
|
||||
|
||||
from odoo import fields, http, SUPERUSER_ID, _
|
||||
# from odoo.exceptions import AccessError, MissingError, ValidationError
|
||||
from odoo.http import request
|
||||
|
||||
# from odoo.addons.portal.controllers.mail import _message_post_helper
|
||||
from odoo.addons.portal.controllers import portal
|
||||
# from odoo.addons.portal.controllers.portal import pager as portal_pager, get_records_pager
|
||||
|
||||
|
||||
class CustomerPortal(portal.CustomerPortal):
|
||||
@@ -15,6 +10,7 @@ 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.with_context('skip_detect_exceptions').write({'task_acceptance': 'accept'})
|
||||
task.sudo().ignore_exception = True
|
||||
task.sudo().task_acceptance = 'accept'
|
||||
task.sudo().ignore_exception = False
|
||||
@@ -24,19 +20,21 @@ class CustomerPortal(portal.CustomerPortal):
|
||||
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.with_context('skip_detect_exceptions').write({'task_acceptance': 'decline'})
|
||||
task.sudo().ignore_exception = True
|
||||
task.sudo().task_acceptance = 'decline'
|
||||
task.sudo().ignore_exception = False
|
||||
|
||||
# @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):
|
||||
# if request.httprequest.method == 'POST':
|
||||
# task = request.env['project.task'].browse([task_id])
|
||||
# task.task_acceptance = 'feedback'
|
||||
# return request.redirect('/my/task/#discussion')
|
||||
|
||||
|
||||
|
||||
######################################################################
|
||||
# The next code is for modal views and to sign document for acceptance
|
||||
#####################################################################
|
||||
# import binascii
|
||||
# from odoo.exceptions import AccessError, MissingError, ValidationError
|
||||
# from odoo.addons.portal.controllers.mail import _message_post_helper
|
||||
# from odoo.addons.portal.controllers.portal import pager as portal_pager, get_records_pager
|
||||
|
||||
# @http.route(['/my/task/<int:task_id>'], type='http', auth="public", website=True)
|
||||
# def portal_my_task(self, task_id, access_token=None, **kw):
|
||||
# try:
|
||||
|
||||
@@ -25,48 +25,17 @@
|
||||
<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 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="{{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="{{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="{{object.get_base_url()}}/my/task/{{object.id}}/#discussion" style="color: #ffffff">
|
||||
<i class="fa fa-comment"/> Feedback</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</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>
|
||||
<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> -->
|
||||
|
||||
|
||||
|
||||
</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'">
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- <odoo noupdate="1"> -->
|
||||
<odoo>
|
||||
|
||||
<record id="except_no_project_id" model="exception.rule">
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
<!-- ###################################################################### -->
|
||||
<!-- The next code is for modal views and to sign document for acceptance -->
|
||||
<!-- ###################################################################### -->
|
||||
|
||||
<!-- <?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
<!-- ###################################################################### -->
|
||||
<!-- The next code is for modal views and to sign document for acceptance -->
|
||||
<!-- ###################################################################### -->
|
||||
|
||||
<!-- <?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
<template id="portal_my_task_inherit" inherit_id="project.portal_my_task">
|
||||
<xpath expr="//div[@class='mt32']" position="before">
|
||||
|
||||
<!-- ###################################################################### -->
|
||||
<!-- The comment code is for modal views and to sign document for acceptance -->
|
||||
<!-- ###################################################################### -->
|
||||
|
||||
<!-- modal relative to the actions accept -->
|
||||
<!-- <div role="dialog" class="modal fade" id="modalaccept">
|
||||
<div class="modal-dialog">
|
||||
@@ -51,35 +55,39 @@
|
||||
</form>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<!-- Message on head for task cancelled state -->
|
||||
<!-- <div t-if="task.stage_id.name == 'cancelled'" class="alert alert-danger alert-dismissable d-print-none" role="alert">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="close">×</button>
|
||||
<strong>This task has been canceled.</strong> <a role="button" href="#discussion"><i class="fa fa-comment"/> Contact us to get.</a>
|
||||
</div> -->
|
||||
|
||||
<div class="row justify-content-center text-center d-print-none pt-1 pb-4">
|
||||
<div class="col-sm-auto mt8">
|
||||
<form id="accept" method="POST" t-attf-action="/my/task/#{task.id}/accept" enctype="multipart/form-data">
|
||||
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
|
||||
<button class="btn btn-primary" t-attf-href="#" style="color: #ffffff"><i class="fa fa-check"/> Accept</button>
|
||||
<!-- <a role="button" class="btn btn-primary" data-toggle="modal" data-target="#modalaccept" href="#" style="color: #ffffff"><i class="fa fa-check"/> Accepted</a> -->
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-sm-auto mt8">
|
||||
<form id="decline" method="POST" t-attf-action="/my/task/#{task.id}/decline" enctype="multipart/form-data">
|
||||
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
|
||||
<button class="btn btn-danger" t-attf-href="#" style="color: #ffffff"> <i class="fa fa-stop-circle"/> Declined</button>
|
||||
<!-- <a role="button" class="btn btn-danger" data-toggle="modal" data-target="#modaldecline" href="#" style="color: #ffffff"> <i class="fa fa-stop-circle"/> Declined</a> -->
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-sm-auto mt8">
|
||||
<!-- <form id="decline" method="POST" t-attf-action="/my/task/#{task.id}/feedback" enctype="multipart/form-data">
|
||||
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/> -->
|
||||
<div t-if="task.stage_id.requires_acceptance">
|
||||
<div class="row justify-content-center text-center d-print-none pt-1 pb-4">
|
||||
<div class="col-sm-auto mt8">
|
||||
<form id="accept" method="POST" t-attf-action="/my/task/#{task.id}/accept" enctype="multipart/form-data">
|
||||
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
|
||||
<button class="btn btn-primary" t-attf-href="#" style="color: #ffffff"><i class="fa fa-check"/> Accept</button>
|
||||
<!-- Modal button -->
|
||||
<!-- <a role="button" class="btn btn-primary" data-toggle="modal" data-target="#modalaccept" href="#" style="color: #ffffff"><i class="fa fa-check"/> Accepted</a> -->
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-sm-auto mt8">
|
||||
<form id="decline" method="POST" t-attf-action="/my/task/#{task.id}/decline" enctype="multipart/form-data">
|
||||
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
|
||||
<button class="btn btn-danger" t-attf-href="#" style="color: #ffffff"> <i class="fa fa-stop-circle"/> Declined</button>
|
||||
<!-- Modal button -->
|
||||
<!-- <a role="button" class="btn btn-danger" data-toggle="modal" data-target="#modaldecline" href="#" style="color: #ffffff"> <i class="fa fa-stop-circle"/> Declined</a> -->
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-sm-auto mt8">
|
||||
<a role="button" class="btn btn-warning" href="#discussion" style="color: #ffffff"><i class="fa fa-comment"/> Feedback</a>
|
||||
<!-- <a t-attf-href="#discussion">
|
||||
<button class="btn btn-warning" style="color: #ffffff"><i class="fa fa-comment"/> Feedback</button>
|
||||
</a>
|
||||
</form> -->
|
||||
<!-- Modal button -->
|
||||
<!-- <form id="decline" method="POST" t-attf-action="/my/task/#{task.id}/feedback" enctype="multipart/form-data">
|
||||
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
|
||||
<a t-attf-href="#discussion">
|
||||
<button class="btn btn-warning" style="color: #ffffff"><i class="fa fa-comment"/> Feedback</button>
|
||||
</a>
|
||||
</form> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
|
||||
Reference in New Issue
Block a user