Skip to content
This repository has been archived by the owner on Dec 17, 2019. It is now read-only.

11.0 #50

Open
wants to merge 10 commits into
base: 11.0
Choose a base branch
from
Open

11.0 #50

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
22 changes: 10 additions & 12 deletions website_support/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,47 +1,45 @@
{
'name': "Website Help Desk / Support Ticket",
'version': "1.4.1",
'author': "Sythil Tech, Adaptive City",
'version': "1.4.2",
'author': "Sythil Tech, Adaptive City, Domatix",
'category': "Tools",
'support': "steven@sythiltech.com.au",
'summary': "A helpdesk / support ticket system for your website",
'description': "A helpdesk / support ticket system for your website",
'license':'LGPL-3',
'license': 'LGPL-3',
'data': [
'data/ir.module.category.csv',
'data/res.groups.xml',
'views/email_templates.xml',
'security/ir.model.access.csv',
'security/website_support_security.xml',
'views/website_support_ticket_templates.xml',
'views/website_support_ticket_compose_views.xml',
'views/website_support_ticket_close_views.xml',
'views/website_support_ticket_views.xml',
'views/website_support_ticket_categories_views.xml',
'views/website_support_ticket_subcategory_views.xml',
'views/website_support_ticket_states_views.xml',
'views/website_support_ticket_stage_views.xml',
'views/website_support_ticket_tag_views.xml',
'views/res_partner_views.xml',
'views/res_users_views.xml',
'views/website_support_help_groups_views.xml',
'views/website_support_help_page_views.xml',
'views/website_support_ticket_priority_views.xml',
'views/website_support_settings_views.xml',
'views/website_support_ticket_department_views.xml',
'views/website_support_sla_views.xml',
'views/menus.xml',
'data/website_support_sequence.xml',
'data/website.support.ticket.states.xml',
'data/website.support.ticket.stage.xml',
'data/website.support.ticket.categories.xml',
'data/website.menu.csv',
'data/website.support.ticket.priority.xml',
'data/website.support.settings.xml',
'data/website.support.department.role.csv',
'data/website.support.ticket.approval.xml',
'data/ir.cron.xml',
'security/ir.model.access.csv',
],
'demo': [],
'depends': ['mail','web', 'website','resource'],
'images':[
'depends': ['mail', 'web', 'website', 'resource'],
'images': [
'static/description/3.jpg',
'static/description/1.jpg',
'static/description/2.jpg',
Expand All @@ -50,4 +48,4 @@
'static/description/6.jpg',
],
'installable': True,
}
}
3 changes: 2 additions & 1 deletion website_support/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-

from . import main
from . import main
from . import myaccount
285 changes: 153 additions & 132 deletions website_support/controllers/main.py

Large diffs are not rendered by default.

120 changes: 120 additions & 0 deletions website_support/controllers/myaccount.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from odoo import http, _
from odoo.http import request
from odoo.addons.portal.controllers.portal import CustomerPortal, pager as portal_pager
from odoo.exceptions import AccessError
from odoo.tools import consteq

class CustomerPortal(CustomerPortal):

def _get_website_support_ticket_domain(self):
partner = request.env.user.partner_id
domain = [
'|',
('message_partner_ids', 'child_of', [partner.commercial_partner_id.id]),
('partner_id', '=', partner.id)
]
return domain

def _prepare_portal_layout_values(self):
values = super(CustomerPortal, self)._prepare_portal_layout_values()
# partner = request.env.user.partner_id
ticket_count = request.env['website.support.ticket'].search_count(
self._get_website_support_ticket_domain())
values['ticket_count'] = ticket_count
return values

def _website_support_ticket_check_access(self, ticket_id, access_token=None):
ticket = request.env['website.support.ticket'].browse([ticket_id])
ticket_sudo = ticket.sudo()
try:
ticket.check_access_rights('read')
ticket.check_access_rule('read')
except AccessError:
if not access_token or not consteq(ticket_sudo.access_token, access_token):
raise
return ticket_sudo

@http.route(['/my/tickets', '/my/tickets/page/<int:page>'], type='http', auth="user", website=True)
def portal_my_tickets(self, page=1, date_begin=None, date_end=None, sortby=None, filterby=None, **kw):
values = self._prepare_portal_layout_values()
# partner = request.env.user.partner_id
WebsiteSupportTicket = request.env['website.support.ticket']

domain = self._get_website_support_ticket_domain()

searchbar_sortings = {
'date': {'label': _('Newest'), 'order': 'create_date desc'},
'subject': {'label': _('Subject'), 'order': 'subject'},
'stage': {'label': _('Stage'), 'order': 'stage'},
'update': {'label': _('Last Stage Update'), 'order': 'date_last_stage_update desc'},
}
searchbar_filters = {'all': {'label': _('All'), 'domain': []}}
for stage in request.env['website.support.ticket.stage'].search([]):
searchbar_filters.update({
str(stage.id): {'label': stage.name, 'domain': [('stage', '=', stage.id)]}
})

# default sort by order
if not sortby:
sortby = 'date'
order = searchbar_sortings[sortby]['order']

# default filter by value
if not filterby:
filterby = 'all'
domain += searchbar_filters[filterby]['domain']

# count for pager
ticket_count = WebsiteSupportTicket.search_count(domain)
# pager
pager = portal_pager(
url="/my/tickets",
url_args={},
total=ticket_count,
page=page,
step=self._items_per_page
)
# content according to pager and archive selected
tickets = WebsiteSupportTicket.search(domain, order=order, limit=self._items_per_page, offset=pager['offset'])
values.update({
'date': date_begin,
'tickets': tickets,
'page_name': 'ticket',
'pager': pager,
# 'archive_groups': archive_groups,
'default_url': '/my/tickets',
'searchbar_sortings': searchbar_sortings,
'sortby': sortby,
'searchbar_filters': searchbar_filters,
'filterby': filterby,
})
return request.render("website_support.portal_my_tickets", values)

@http.route(['/my/tickets/<int:ticket_id>'], type='http', auth="public", website=True)
def portal_my_ticket_page(self, ticket_id=None, access_token=None, **kw):
try:
ticket_sudo = self._website_support_ticket_check_access(ticket_id, access_token)
except AccessError:
return request.redirect('/my')
values = self._ticket_get_page_view_values(ticket_sudo, access_token, **kw)
return request.render("website_support.portal_ticket_page", values)

def _ticket_get_page_view_values(self, ticket, access_token, **kwargs):
values = {
'page_name': 'ticket',
'ticket': ticket,
}

if access_token:
values['no_breadcrumbs'] = True
values['access_token'] = access_token
if kwargs.get('error'):
values['error'] = kwargs['error']
if kwargs.get('warning'):
values['warning'] = kwargs['warning']
if kwargs.get('success'):
values['success'] = kwargs['success']

return values
2 changes: 1 addition & 1 deletion website_support/data/ir.cron.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
</record>

</data>
</odoo>
</odoo>
10 changes: 5 additions & 5 deletions website_support/data/website.support.settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@

<function id="default_change_user_email_template_id"
model="ir.default" name="set"
eval="('website.support.settings', 'change_user_email_template_id', ref('website_support.support_ticket_user_change') )"/>
eval="('res.config.settings', 'change_user_email_template_id', ref('website_support.support_ticket_user_change') )"/>

<function id="default_close_ticket_email_template_id"
model="ir.default" name="set"
eval="('website.support.settings', 'close_ticket_email_template_id', ref('website_support.support_ticket_closed') )"/>
eval="('res.config.settings', 'close_ticket_email_template_id', ref('website_support.support_ticket_closed') )"/>

<function id="default_staff_reply_email_template_id"
model="ir.default" name="set"
eval="('website.support.settings', 'staff_reply_email_template_id', ref('website_support.support_ticket_reply_wrapper') )"/>
eval="('res.config.settings', 'staff_reply_email_template_id', ref('website_support.support_ticket_reply_wrapper') )"/>

<function id="default_max_ticket_attachments"
model="ir.default" name="set"
eval="('website.support.settings', 'max_ticket_attachments', 2 )"/>
eval="('res.config.settings', 'max_ticket_attachments', 2 )"/>

<function id="default_max_ticket_attachment_filesize"
model="ir.default" name="set"
eval="('website.support.settings', 'max_ticket_attachment_filesize', 500 )"/>
eval="('res.config.settings', 'max_ticket_attachment_filesize', 500 )"/>

</data>
</odoo>
31 changes: 0 additions & 31 deletions website_support/data/website.support.ticket.priority.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,48 @@
<odoo>
<data noupdate="1">

<record id="website_ticket_state_open" model="website.support.ticket.states">
<record id="website_ticket_stage_open" model="website.support.ticket.stage">
<field name="name">Open</field>
<field name="mail_template_id" ref="support_ticket_new"/>
<field name="unattended">True</field>
</record>

<record id="website_ticket_state_staff_replied" model="website.support.ticket.states">
<record id="website_ticket_stage_staff_replied" model="website.support.ticket.stage">
<field name="name">Staff Replied</field>
<field name="fold">True</field>
</record>

<record id="website_ticket_state_customer_replied" model="website.support.ticket.states">
<record id="website_ticket_stage_customer_replied" model="website.support.ticket.stage">
<field name="name">Customer Replied</field>
<field name="unattended">True</field>
</record>

<record id="website_ticket_state_awaiting_approval" model="website.support.ticket.states">
<record id="website_ticket_stage_awaiting_approval" model="website.support.ticket.stage">
<field name="name">Awaiting Approval</field>
<field name="fold">True</field>
</record>

<record id="website_ticket_state_approval_accepted" model="website.support.ticket.states">
<record id="website_ticket_stage_approval_accepted" model="website.support.ticket.stage">
<field name="name">Approval Accepted</field>
<field name="unattended">True</field>
</record>

<record id="website_ticket_state_approval_rejected" model="website.support.ticket.states">
<record id="website_ticket_stage_approval_rejected" model="website.support.ticket.stage">
<field name="name">Approval Rejected</field>
<field name="unattended">True</field>
</record>

<record id="website_ticket_state_customer_closed" model="website.support.ticket.states">
<record id="website_ticket_stage_customer_closed" model="website.support.ticket.stage">
<field name="name">Customer Closed</field>
<field name="fold">True</field>
<field name="mail_template_id" ref="support_ticket_closed"/>
</record>

<record id="website_ticket_state_staff_closed" model="website.support.ticket.states">
<record id="website_ticket_stage_staff_closed" model="website.support.ticket.stage">
<field name="name">Staff Closed</field>
<field name="fold">True</field>
<field name="mail_template_id" ref="support_ticket_closed"/>
</record>
</data>
</odoo>

</data>
</odoo>
20 changes: 16 additions & 4 deletions website_support/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
v1.4.2
======
* Drop-down menu item Support, with the diferents options.
* Redesign website tickets view moved to Portal account.
* Redesign of kanban view.
* Priority with stars.
* Changed "state" name for "stage".
* Changed "portal_acces_key" for "access_token".
* Redesign of settings.
* SLA, Groups and Help pages in settings for enable/disable.


v1.4.1
======
* Fix issue with survey link appearing as _survey_url_ in chatter
Expand Down Expand Up @@ -79,9 +91,9 @@ v1.2.13

v1.2.12
=======
* Website filter state for tickets
* Website filter stage for tickets
* Hide SLA resume and pause buttons if no SLA is assigned to the ticket
* Choose which states get classified as unattended
* Choose which stage get classified as unattended

v1.2.11
=======
Expand Down Expand Up @@ -163,7 +175,7 @@ v1.0.9
v1.0.8
======
* Fix subcategory change not disappearing
* States no longer readonly
* stage no longer readonly
* Move Kanban view over from Odoo 10

v1.0.7
Expand Down Expand Up @@ -196,4 +208,4 @@ v1.0.1

v1.0
====
* Port to version 11
* Port to version 11
Loading