[WIP] project_acceptance:created email template, added fields and buttons

H11043
This commit is contained in:
Leo Pinedo
2022-09-28 23:54:49 +00:00
parent 58666c3806
commit 04cfe42d55
9 changed files with 131 additions and 0 deletions

View File

@@ -0,0 +1 @@
from . import models

View File

@@ -0,0 +1,19 @@
{
'name': 'Project Acceptance',
'version': '15.0.1.0.0',
'author': 'Hibou Corp. <hello@hibou.io>',
'website': 'https://hibou.io/',
'license': 'AGPL-3',
'category': 'Tools',
'complexity': 'easy',
'description': """ """,
'depends': [
'project',
],
'data': [
'data/mail_template_data.xml',
'views/project_portal_templates.xml',
],
'installable': True,
'auto_install': False,
}

View File

@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="project_acceptance_email_template" model="mail.template">
<field name="name">Task Acceptance</field>
<field name="model_id" ref="project.model_project_task"/>
<field name="subject">{{ object.display_name }}: Task Approval Request</field>
<field name="email_from">{{ (object.rating_get_rated_partner_id().email_formatted if object.rating_get_rated_partner_id() else user.email_formatted) }}</field>
<field name="partner_to" >{{ object.rating_get_partner_id().id }}</field>
<field name="body_html" type="html">
<div>
<t t-set="access_token" t-value="object.rating_get_access_token()"/>
<t t-set="partner" t-value="object.rating_get_partner_id()"/>
<table border="0" cellpadding="0" cellspacing="0" width="590" style="width:100%; margin:0px auto;">
<tbody>
<tr><td valign="top" style="font-size: 13px;">
<t t-if="partner.name">
Hello <t t-out="partner.name or ''">Brandon Freeman</t>,<br/><br/>
</t>
<t t-else="">
Hello,<br/><br/>
</t>
Please take a moment to review and approve, decline or provide feedback on this task: "<strong t-out="object.display_name or ''"></strong>"
</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/>
</td></tr>
<tr><td style="font-size: 13px;">
<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="#" 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="#" 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="#" style="color: #ffffff"><i class="fa fa-comment"/> Feedback</a>
</td>
</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'">
<br/><span style="margin: 0px 0px 0px 0px; font-size: 12px; opacity: 0.5; color: #454748;">This customer survey has been sent because your task has been moved to the stage <b t-out="object.stage_id.name or ''">In progress</b></span>
</t>
</td></tr>
</tbody>
</table>
</div>
</field>
<field name="lang">{{ object.rating_get_partner_id().lang }}</field>
<field name="auto_delete" eval="True"/>
</record>
</data>
</odoo>

View File

@@ -0,0 +1 @@
from . import project

View File

@@ -0,0 +1,13 @@
from odoo import api, fields, models
class ProjectProjectStage(models.Model):
_inherit = 'project.project.stage'
requires_acceptance = fields.Boolean('Require Acceptance')
class ProjectTask(models.Model):
_inherit = 'project.task'
task_acceptance = fields.Selection([('accept', 'Accepted'), ('decline', 'Decline'), ('feedback', 'Feedback Provided')])

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M256 512c141.4 0 256-114.6 256-256S397.4 0 256 0S0 114.6 0 256S114.6 512 256 512zM192 160H320c17.7 0 32 14.3 32 32V320c0 17.7-14.3 32-32 32H192c-17.7 0-32-14.3-32-32V192c0-17.7 14.3-32 32-32z"/></svg>

After

Width:  |  Height:  |  Size: 439 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M256 32C114.6 32 .0272 125.1 .0272 240c0 47.63 19.91 91.25 52.91 126.2c-14.88 39.5-45.87 72.88-46.37 73.25c-6.625 7-8.375 17.25-4.625 26C5.818 474.2 14.38 480 24 480c61.5 0 109.1-25.75 139.1-46.25C191.1 442.8 223.3 448 256 448c141.4 0 255.1-93.13 255.1-208S397.4 32 256 32zM256.1 400c-26.75 0-53.12-4.125-78.38-12.12l-22.75-7.125l-19.5 13.75c-14.25 10.12-33.88 21.38-57.5 29c7.375-12.12 14.37-25.75 19.88-40.25l10.62-28l-20.62-21.87C69.82 314.1 48.07 282.2 48.07 240c0-88.25 93.25-160 208-160s208 71.75 208 160S370.8 400 256.1 400z"/></svg>

After

Width:  |  Height:  |  Size: 779 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zM337 209L209 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L303 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"/></svg>

After

Width:  |  Height:  |  Size: 496 B

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_my_task_inherit" inherit_id="project.portal_my_task">
<xpath expr="//div[@class='mt32']" position="before">
<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" data-toggle="modal" data-target="#modalaccept" href="#"><i class="fa fa-check"/>Accept</a> -->
<!-- <a role="button" class="btn btn-primary" t-attf-href="#" style="color: #ffffff"><i class="fa fa-check"/> Accepted</a> -->
<a role="button" class="btn btn-primary" data-toggle="modal" data-target="#modalaccept" href="#" style="color: #ffffff"><i class="fa fa-check"/> Accepted</a>
</div>
<div class="col-sm-auto mt8">
<!-- <a role="button" class="btn btn-danger" data-toggle="modal" data-target="#modaldecline" href="#"> <i class="fa fa-times"/>Decline</a> -->
<a role="button" class="btn btn-danger" t-attf-href="#" style="color: #ffffff"> <i class="fa fa-stop-circle"/> Declined</a>
</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>
</div>
</div>
</xpath>
</template>
</odoo>