Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][IMP]helpdesk_mgmt: simplify email templates #644

Open
wants to merge 3 commits into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion helpdesk_mgmt/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Stages
#. Edit or create a new stage.
#. Set the name for the stage.
#. Set the sequence order for the stage.
#. You can select an Email template.
#. You can select an email template that will be automatically sent when a ticket reaches this stage.
#. Mark the Unattended checkbox if the stage contains unattended tickets.
#. Mark the Closed checkbox if the stage contains closed tickets.
#. You can add a description for the stage.
Expand Down Expand Up @@ -222,6 +222,10 @@ Contributors
* Marcel Savegnago
* Eduardo Aparício

* `TAKOBI <https://takobi.online>`_:

* Lorenzo Battistini

* `Obertix <https://www.obertix.net>`_:

* Vicent Cubells
Expand Down
1 change: 1 addition & 0 deletions helpdesk_mgmt/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"depends": ["mail", "portal"],
"data": [
"data/helpdesk_data.xml",
"data/ir_config_parameter.xml",
"security/helpdesk_security.xml",
"security/ir.model.access.csv",
"views/res_partner_views.xml",
Expand Down
1 change: 1 addition & 0 deletions helpdesk_mgmt/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def _prepare_submit_ticket_vals(self, **kw):
"channel_id": request.env.ref(
"helpdesk_mgmt.helpdesk_ticket_channel_web", False
).id,
"stage_id": request.env.ref("helpdesk_mgmt.helpdesk_ticket_stage_new").id,
"partner_id": request.env.user.partner_id.id,
"partner_name": request.env.user.partner_id.name,
"partner_email": request.env.user.partner_id.email,
Expand Down
235 changes: 47 additions & 188 deletions helpdesk_mgmt/data/helpdesk_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,105 +32,53 @@
<field name="model_id" ref="helpdesk_mgmt.model_helpdesk_ticket" />
<field name="email_from">{{object.company_id.partner_id.email}}</field>
<field
name="email_cc"
>{{not object.partner_id and object.partner_email or ''}},</field>
name="email_to"
>${not object.partner_id and object.partner_email or ''|safe},</field>
<field name="subject">The ticket {{object.number}} has been closed.</field>
<field name="partner_to">{{object.partner_id.id}}</field>
<field name="auto_delete" eval="False" />
<field name="lang">{{object.partner_id.lang}}</field>
<field name="body_html" type="html">
<table
border="0"
width="100%"
cellpadding="0"
bgcolor="#ededed"
style="padding: 20px; background-color: #ededed; border-collapse:separate;"
>
<tbody>
<!-- HEADER -->
<tr>
<td align="center" style="min-width: 590px;">
<table
width="590"
border="0"
cellpadding="0"
bgcolor="#875A7B"
style="min-width: 590px; background-color: rgb(135,90,123); padding: 20px; border-collapse:separate;"
>
<tr>
<td valign="middle" align="right">
<img
t-att-src="'/logo.png?company=%s' % object.company_id.id"
style="padding: 0px; margin: 0px; height: auto; width: 80px;"
t-att-alt="'%s' % object.company_id.name"
/>
</td>
</tr>
</table>
</td>
</tr>
<!-- CONTENT -->
<tr>
<td align="center" style="min-width: 590px;">
<table
width="590"
border="0"
cellpadding="0"
bgcolor="#ffffff"
style="min-width: 590px; background-color: rgb(255, 255, 255); padding: 20px; border-collapse:separate;"
>
<tbody>
<td
valign="top"
style="font-family:Arial,Helvetica,sans-serif; color: #555; font-size: 14px;"
>
<p>Hello <t t-out="object.user_id.name" />,</p>
<p>The ticket "<t
t-out="object.display_name"
/>" has been closed.</p>
</td>
</tbody>
</table>
</td>
</tr>
<!-- FOOTER -->
<tr>
<td align="center" style="min-width: 590px;">
<table
width="590"
border="0"
cellpadding="0"
bgcolor="#875A7B"
style="min-width: 590px; background-color: rgb(135,90,123); padding: 20px; border-collapse:separate;"
>
<tr>
<td
valign="middle"
align="left"
style="color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;"
>
<t t-out="object.company_id.phone" />
</td>
<td
valign="middle"
align="left"
style="color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;"
>
<t t-out="object.company_id.email" />
</td>
<td
valign="middle"
align="left"
style="color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;"
>
<t t-out="object.company_id.website" />
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
<div>
<p>Hello ${object.partner_id.name or object.partner_name or ''},</p>
<p>The ticket "${object.display_name or 'n/a'}" has been closed.</p>
% if object.partner_can_access():
<div style="margin: 16px 0px 16px 0px;">
<a
href="${object.get_access_link()}"
style="background-color: #875A7B; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px; font-size:13px;"
>
View Ticket
</a>
</div>
% endif
Thank you,<br /><br />
${user.signature | safe}<br />
</div>
</field>
</record>
<record id="created_ticket_template" model="mail.template">
<field name="name">Helpdesk Created Ticket Notification Email</field>
<field name="model_id" ref="helpdesk_mgmt.model_helpdesk_ticket" />
<field name="email_from">${object.company_id.partner_id.email}</field>
<field
name="email_to"
>${('' if object.partner_id.email and object.partner_id.email == object.partner_email else object.partner_email) | safe},</field>
<field name="subject">The ticket ${object.number} has been created.</field>
<field
name="partner_to"
>${object.partner_id.id if object.partner_id.email and object.partner_id.email == object.partner_email else False}</field>
<field name="auto_delete" eval="False" />
<field name="lang">${object.partner_id.lang}</field>
<field
name="body_html"
><![CDATA[<html>
<div>
<p>Hello ${object.partner_id.name or object.partner_name or ''},</p>
<p>The ticket "${object.display_name or 'n/a'}" has been created.</p>
<p>You can reply to this email to add information to the ticket.</p>
</div>
]]>
</field>
</record>
<record id="changed_stage_template" model="mail.template">
Expand All @@ -147,100 +95,11 @@
<field name="auto_delete" eval="False" />
<field name="lang">{{object.partner_id.lang}}</field>
<field name="body_html" type="html">
<table
border="0"
width="100%"
cellpadding="0"
bgcolor="#ededed"
style="padding: 20px; background-color: #ededed; border-collapse:separate;"
>
<tbody>
<!-- HEADER -->
<tr>
<td align="center" style="min-width: 590px;">
<table
width="590"
border="0"
cellpadding="0"
bgcolor="#875A7B"
style="min-width: 590px; background-color: rgb(135,90,123); padding: 20px; border-collapse:separate;"
>
<tr>
<td valign="middle" align="right">
<img
t-att-src="'/logo.png?company=%s' % object.company_id.id"
style="padding: 0px; margin: 0px; height: auto; width: 80px;"
t-att-alt="'%s' % object.company_id.name"
/>
</td>
</tr>
</table>
</td>
</tr>
<!-- CONTENT -->
<tr>
<td align="center" style="min-width: 590px;">
<table
width="590"
border="0"
cellpadding="0"
bgcolor="#ffffff"
style="min-width: 590px; background-color: rgb(255, 255, 255); padding: 20px; border-collapse:separate;"
>
<tbody>
<td
valign="top"
style="font-family:Arial,Helvetica,sans-serif; color: #555; font-size: 14px;"
>
<p>Hello <t t-out="object.user_id.name" />,</p>
<p>The ticket "<t
t-out="object.display_name"
/>" stage has changed to <t
t-out="object.stage_id.name"
/>.</p>
</td>
</tbody>
</table>
</td>
</tr>
<!-- FOOTER -->
<tr>
<td align="center" style="min-width: 590px;">
<table
width="590"
border="0"
cellpadding="0"
bgcolor="#875A7B"
style="min-width: 590px; background-color: rgb(135,90,123); padding: 20px; border-collapse:separate;"
>
<tr>
<td
valign="middle"
align="left"
style="color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;"
>
<t t-out="object.company_id.phone" />
</td>
<td
valign="middle"
align="left"
style="color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;"
>
<t t-out="object.company_id.email" />
</td>
<td
valign="middle"
align="left"
style="color: #fff; padding-top: 10px; padding-bottom: 10px; font-size: 12px;"
>
<t t-out="object.company_id.website" />
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
<div>
<p>Hello ${object.partner_id.name or object.partner_name or ''},</p>
<p
>The ticket "${object.display_name}" stage has changed to ${object.stage_id.name}.</p>
</div>
</field>
</record>
<!-- Sequence -->
Expand Down
9 changes: 9 additions & 0 deletions helpdesk_mgmt/data/ir_config_parameter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">

<record model="ir.config_parameter" id="created_ticket_template_name">
<field name="key">helpdesk_mgmt.created_ticket_template_name</field>
<field name="value">helpdesk_mgmt.created_ticket_template</field>
</record>

</odoo>
Loading
Loading