mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[WIP] project_acceptance: new changes by functionality of buttons
H11043
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
'description': """ """,
|
||||
'depends': [
|
||||
'project',
|
||||
# 'project_exception',
|
||||
'project_exception',
|
||||
],
|
||||
'data': [
|
||||
'data/mail_template_data.xml',
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
from . import mail
|
||||
from . import portal
|
||||
|
||||
16
project_acceptance/controllers/mail.py
Normal file
16
project_acceptance/controllers/mail.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from odoo import http
|
||||
from odoo.http import request
|
||||
|
||||
from odoo.addons.portal.controllers import mail
|
||||
|
||||
|
||||
class PortalChatter(mail.PortalChatter):
|
||||
|
||||
|
||||
@http.route()
|
||||
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'
|
||||
return super(PortalChatter, self).portal_chatter_post(res_model, res_id, message, attachment_ids=attachment_ids, attachment_tokens=attachment_tokens, **kwargs)
|
||||
|
||||
@@ -1,25 +1,36 @@
|
||||
import binascii
|
||||
# import binascii
|
||||
|
||||
from odoo import fields, http, SUPERUSER_ID, _
|
||||
from odoo.exceptions import AccessError, MissingError, ValidationError
|
||||
# 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.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
|
||||
# from odoo.addons.portal.controllers.portal import pager as portal_pager, get_records_pager
|
||||
|
||||
|
||||
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':
|
||||
task = request.env['project.task'].browse([task_id])
|
||||
task.task_acceptance = 'accept'
|
||||
|
||||
@http.route(['/my/task/<int:task_id>/modaccept'], type='json', auth="public", website=True)
|
||||
def portal_quote_accept(self, task_id, access_token=None, name=None, signature=None):
|
||||
pass
|
||||
@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'
|
||||
|
||||
# @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')
|
||||
|
||||
|
||||
@http.route(['/my/task/<int:task_id>/decline'], type='http', auth="public", methods=['POST'], website=True)
|
||||
def decline(self, task_id, access_token=None, **post):
|
||||
pass
|
||||
|
||||
# @http.route(['/my/task/<int:task_id>'], type='http', auth="public", website=True)
|
||||
# def portal_my_task(self, task_id, access_token=None, **kw):
|
||||
|
||||
@@ -31,24 +31,15 @@
|
||||
<table style="width:100%;text-align:center;margin-top:2rem;">
|
||||
<tr>
|
||||
<td>
|
||||
<!-- <a t-attf-href="/rate/{{ access_token }}/5">
|
||||
<img alt="Accepted" src="./static/src/img/square-check-solid.svg" title="Accepted"/>
|
||||
</a> -->
|
||||
<a role="button" class="btn btn-primary" t-attf-href="/rate/{{ access_token }}/5" style="color: #ffffff">
|
||||
<a role="button" class="btn btn-primary" t-attf-href="/my/task/#{task.id}/accept" style="color: #ffffff">
|
||||
<i class="fa fa-check"/> Accepted</a>
|
||||
</td>
|
||||
<td>
|
||||
<!-- <a t-attf-href="/rate/{{ access_token }}/3">
|
||||
<img alt="Declined" src="./static/src/img/circle-stop-solid.svg" title="Declined"/>
|
||||
</a> -->
|
||||
<a role="button" class="btn btn-danger" t-attf-href="/rate/{{ access_token }}/3" style="color: #ffffff">
|
||||
<a role="button" class="btn btn-danger" t-attf-href="/my/task/#{task.id}/decline" style="color: #ffffff">
|
||||
<i class="fa fa-stop-circle"/> Declined</a>
|
||||
</td>
|
||||
<td>
|
||||
<!-- <a t-attf-href="/rate/{{ access_token }}/1">
|
||||
<img alt="Feedback" src="./static/src/img/comment-regular.svg" title="Feedback Provided"/>
|
||||
</a> -->
|
||||
<a role="button" class="btn btn-warning" t-attf-href="/rate/{{ access_token }}/1" style="color: #ffffff">
|
||||
<a role="button" class="btn btn-warning" t-attf-href="/my/task/#{task.id}/feedback" style="color: #ffffff">
|
||||
<i class="fa fa-comment"/> Feedback</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- <odoo noupdate="1"> -->
|
||||
<odoo>
|
||||
<record id="task_acceptance_rule_" model="ir.rule">
|
||||
<field name="name"></field>
|
||||
<field name="model_id" ref=""/>
|
||||
<field name="domain_force">[('', '', ), ('', '', )]</field>
|
||||
<field name="groups" eval="[(4, ref('project.group_project_user'))]"/>
|
||||
<field name="perm_create" eval="1"/>
|
||||
<field name="perm_write" eval="1"/>
|
||||
<field name="perm_unlink" eval="1"/>
|
||||
<field name="perm_read" eval="0"/>
|
||||
|
||||
<record id="task_acceptance_rule_" model="exception.rule">
|
||||
<field name="name">Task Acceptance Exception Rule</field>
|
||||
<field name="description">Task Acceptance Exception Rule</field>
|
||||
<field name="sequence">50</field>
|
||||
<field name="model">project.task</field>
|
||||
<field name="code">
|
||||
<!-- if task.stage_id.name == 'Accept Required' and task.task_acceptance == False: failed=True -->
|
||||
</field>
|
||||
<field name="active" eval="False"/>
|
||||
<!-- if task.stage_id.name == 'In progress' and task.task_acceptance == False: failed=True -->
|
||||
<!-- stage_id == 'Accept Required' -->
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -58,19 +58,28 @@
|
||||
</div> -->
|
||||
|
||||
<div class="row justify-content-center text-center d-print-none pt-1 pb-4">
|
||||
<div t-if="not sale_order_exceptions" class="col-sm-auto mt8">
|
||||
<a role="button" class="btn btn-primary" t-attf-href="#" style="color: #ffffff"><i class="fa fa-check"/> Accepted</a>
|
||||
<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">
|
||||
<a role="button" class="btn btn-danger" t-attf-href="#" style="color: #ffffff"> <i class="fa fa-stop-circle"/> Declined</a>
|
||||
<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">
|
||||
<!-- <a role="button" class="btn btn-secondary" href="#discussion"><i class="fa fa-comment"/> Feedback</a> -->
|
||||
<a role="button" class="btn btn-warning" t-attf-href="#discussion" style="color: #ffffff"><i class="fa fa-comment"/> Feedback</a>
|
||||
<!-- <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 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> -->
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
|
||||
Reference in New Issue
Block a user