[WIP] project_acceptance: change on controllers for exception rule

H11043
This commit is contained in:
Leo Pinedo
2022-10-05 16:00:22 +00:00
parent b0da2f59c9
commit 1cf7cf38dc
4 changed files with 12 additions and 6 deletions

View File

@@ -11,6 +11,8 @@ 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.task_acceptance = 'feedback'
task.sudo().ignore_exception = True
task.sudo().task_acceptance = 'feedback'
task.sudo().ignore_exception = False
return super(PortalChatter, self).portal_chatter_post(res_model, res_id, message, attachment_ids=attachment_ids, attachment_tokens=attachment_tokens, **kwargs)

View File

@@ -13,15 +13,20 @@ class CustomerPortal(portal.CustomerPortal):
@http.route('/my/task/<int:task_id>/accept', type='http', auth="user", website=True)
def portal_task_accept(self, task_id, access_token=None, **post):
if request.httprequest.method == 'POST':
if request.httprequest.method == 'POST':
task = request.env['project.task'].browse([task_id])
task.sudo().task_acceptance = 'accept'
task.sudo().ignore_exception = True
task.sudo().task_acceptance = 'accept'
task.sudo().ignore_exception = False
@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.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):

View File

@@ -52,7 +52,7 @@
<!-- <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 to go to the portal and confirm your selection</strong><br/>
</td></tr>
<tr><td style="font-size: 13px;">

View File

@@ -7,8 +7,7 @@
<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">failed = not task.task_acceptance and task.stage_id.requires_acceptance</field>
<field name="code">if not task.task_acceptance and task.stage_id.requires_acceptance: failed=True</field>
<field name="active" eval="False"/>
</record>