Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Arturo Jasso Origel
/
helpdesk
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3f72f378
authored
a year ago
by
Arturo Jasso Origel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restableciendo cambios de other_odoo_login
parent
5d9ba670
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
149 additions
and
137 deletions
+149
-137
helpdesk_maintenance/controllers/portal.py
+70
-73
helpdesk_maintenance/data/helpdesk_team.xml
+11
-2
helpdesk_maintenance/data/maintenance_type.xml
+1
-1
helpdesk_maintenance/models/helpdesk_ticket.py
+0
-2
helpdesk_maintenance/static/src/js/portal.js
+16
-9
helpdesk_maintenance/views/portal_emergency.xml
+19
-6
helpdesk_maintenance/views/portal_maintenance.xml
+14
-4
helpdesk_maintenance/views/portal_my.xml
+4
-1
other_odoo_login/controllers/main.py
+13
-22
other_odoo_login/models/res_company.py
+1
-17
No files found.
helpdesk_maintenance/controllers/portal.py
View file @
3f72f378
...
...
@@ -97,7 +97,7 @@ class PortalCustomerMaintenence(CustomerPortal):
@http.route
([
'/my/mantenimientos'
,
'/my/mantenimientos/page/<int:page>'
],
type
=
'http'
,
auth
=
"user"
,
website
=
True
)
def
portal_my_maintenance
(
self
,
ctr
=
'show'
,
page
=
1
,
sortby
=
None
,
filterby
=
None
,
search
=
None
,
search_in
=
'all'
,
groupby
=
'
create_by
'
,
**
kw
):
def
portal_my_maintenance
(
self
,
ctr
=
'show'
,
page
=
1
,
sortby
=
None
,
filterby
=
None
,
search
=
None
,
search_in
=
'all'
,
groupby
=
'
status
'
,
**
kw
):
values
=
self
.
_prepare_portal_layout_values
()
HelpdeskTicket
=
request
.
env
[
'helpdesk.ticket'
]
.
sudo
()
searchbar_sortings
=
{
...
...
@@ -118,42 +118,23 @@ class PortalCustomerMaintenence(CustomerPortal):
}
searchbar_groupby
=
{
'create_by'
:
{
'input'
:
'create_by'
,
'label'
:
_
(
'Created By'
)
},
'ticket_type'
:
{
'input'
:
'ticket_type'
,
'label'
:
_
(
'Ticket Type'
)
},
'status'
:
{
'input'
:
'status'
,
'label'
:
_
(
'Status'
)
},
'customer'
:
{
'input'
:
'customer'
,
'label'
:
_
(
'Customer'
)
},
'category'
:
{
'input'
:
'category'
,
'label'
:
_
(
'Category'
)
},
'subcategory'
:
{
'input'
:
'subcategory'
,
'label'
:
_
(
'Sub Category'
)
},
'subject'
:
{
'input'
:
'subject'
,
'label'
:
_
(
'Subject'
)
},
'priority'
:
{
'input'
:
'priority'
,
'label'
:
_
(
'Priority'
)
},
'state'
:
{
'input'
:
'state'
,
'label'
:
_
(
'Reply Status'
)
},
}
today
=
fields
.
Date
.
today
()
...
...
@@ -283,6 +264,9 @@ class PortalCustomerMaintenence(CustomerPortal):
maintenance_count
=
len
(
HelpdeskTicket
.
search
(
domain
)
.
filtered
(
lambda
h
:
h
.
team_id
.
id
==
request
.
env
.
ref
(
'helpdesk_maintenance.maintenance'
)
.
id
))
# pager
pager
=
portal_pager
(
url
=
"/my/mantenimientos"
,
url_args
=
{
'sortby'
:
sortby
,
'search_in'
:
search_in
,
'search'
:
search
,
'filterby'
:
filterby
},
total
=
maintenance_count
,
page
=
page
,
step
=
self
.
_items_per_page
)
if
groupby
==
'create_by'
:
...
...
@@ -303,6 +287,10 @@ class PortalCustomerMaintenence(CustomerPortal):
order
=
"priority,
%
s"
%
order
elif
groupby
==
'state'
:
order
=
'state,
%
s'
%
order
elif
groupby
==
'maintenance_type'
:
order
=
"maintenance_type_id,
%
s"
%
order
elif
groupby
==
'severity_type'
:
order
=
"severity_type,
%
s"
%
order
tickets
=
HelpdeskTicket
.
search
(
domain
,
order
=
order
,
limit
=
self
.
_items_per_page
,
offset
=
pager
[
'offset'
])
request
.
session
[
'my_tickets_history'
]
=
tickets
.
ids
[:
100
]
...
...
@@ -351,6 +339,16 @@ class PortalCustomerMaintenence(CustomerPortal):
HelpdeskTicket
.
concat
(
*
g
)
for
k
,
g
in
groupbyelem
(
tickets
,
itemgetter
(
'state'
))
]
elif
groupby
==
'maintenance_type'
:
grouped_tickets
=
[
HelpdeskTicket
.
concat
(
*
g
)
for
k
,
g
in
groupbyelem
(
tickets
,
itemgetter
(
'maintenance_type_id'
))
]
elif
groupby
==
'severity_type'
:
grouped_tickets
=
[
HelpdeskTicket
.
concat
(
*
g
)
for
k
,
g
in
groupbyelem
(
tickets
,
itemgetter
(
'severity_type'
))
]
# content according to pager and archive selected
values
.
update
({
'created'
:
ctr
,
...
...
@@ -442,7 +440,7 @@ class PortalCustomerMaintenence(CustomerPortal):
if
kw
.
get
(
'portal_date_fail'
):
ticket_dic
.
update
({
'date_fail'
:
datetime
.
strptime
(
kw
.
get
(
'portal_date_fail'
),
FORMAT
)
.
date
(),
'date_fail'
:
datetime
.
strptime
(
kw
.
get
(
'portal_date_fail'
),
"
%
d-
%
m-
%
Y"
)
.
date
(),
})
if
kw
.
get
(
'portal_fail_type'
):
...
...
@@ -502,11 +500,22 @@ class PortalCustomerMaintenence(CustomerPortal):
'partner_id'
:
ticket_sudo
.
partner_id
.
id
,
'report_type'
:
'html'
,
}
if
ticket_sudo
.
maintenance_type_id
.
id
==
request
.
env
.
ref
(
'helpdesk_maintenance.emergency'
)
.
id
and
ticket_sudo
.
severity_type
==
'3'
:
values
=
{
'token'
:
access_token
,
'm_emergency'
:
ticket_sudo
,
'message'
:
message
,
'bootstrap_formatting'
:
True
,
'partner_id'
:
ticket_sudo
.
partner_id
.
id
,
'report_type'
:
'html'
,
}
return
request
.
render
(
"helpdesk_maintenance.portal_ticket_page_maintenance_emergency"
,
values
)
return
request
.
render
(
"helpdesk_maintenance.portal_ticket_page_maintenance"
,
values
)
#apartado de emergencia
@http.route
([
'/my/mantenimientos/emergencias'
,
'/my/mantenimientos/emergencias/page/<int:page>'
],
type
=
'http'
,
auth
=
"user"
,
website
=
True
)
def
portal_my_maintenance_emergency
(
self
,
ctr
=
'show'
,
page
=
1
,
sortby
=
None
,
filterby
=
None
,
search
=
None
,
search_in
=
'all'
,
groupby
=
'
create_by
'
,
**
kw
):
def
portal_my_maintenance_emergency
(
self
,
ctr
=
'show'
,
page
=
1
,
sortby
=
None
,
filterby
=
None
,
search
=
None
,
search_in
=
'all'
,
groupby
=
'
status
'
,
**
kw
):
values
=
self
.
_prepare_portal_layout_values
()
HelpdeskTicket
=
request
.
env
[
'helpdesk.ticket'
]
.
sudo
()
searchbar_sortings
=
{
...
...
@@ -527,42 +536,23 @@ class PortalCustomerMaintenence(CustomerPortal):
}
searchbar_groupby
=
{
'create_by'
:
{
'input'
:
'create_by'
,
'label'
:
_
(
'Created By'
)
},
'ticket_type'
:
{
'input'
:
'ticket_type'
,
'label'
:
_
(
'Ticket Type'
)
},
'status'
:
{
'input'
:
'status'
,
'label'
:
_
(
'Status'
)
},
'customer'
:
{
'input'
:
'customer'
,
'label'
:
_
(
'Customer'
)
'maintenance_type'
:
{
'input'
:
'maintenance_type'
,
'label'
:
_
(
'Tipo de mantenimiento'
)
},
'category'
:
{
'input'
:
'category'
,
'label'
:
_
(
'Category'
)
},
'subcategory'
:
{
'input'
:
'subcategory'
,
'label'
:
_
(
'Sub Category'
)
},
'subject'
:
{
'input'
:
'subject'
,
'label'
:
_
(
'Subject'
)
},
'priority'
:
{
'input'
:
'priority'
,
'label'
:
_
(
'Priority'
)
},
'state'
:
{
'input'
:
'state'
,
'label'
:
_
(
'Reply Status'
)
'severity_type'
:
{
'input'
:
'severity_type'
,
'label'
:
_
(
'Gravedad'
)
},
}
today
=
fields
.
Date
.
today
()
...
...
@@ -687,11 +677,8 @@ class PortalCustomerMaintenence(CustomerPortal):
domain
=
AND
([
domain
,
ticket_domain
])
maintenance_count
=
len
(
HelpdeskTicket
.
search
(
domain
)
.
filtered
(
lambda
h
:
h
.
team_id
.
id
==
request
.
env
.
ref
(
'helpdesk_maintenance.maintenance'
)
.
id
and
h
.
maintenance_type_id
.
id
==
request
.
env
.
ref
(
'helpdesk_maintenance.emergency'
)
.
id
))
maintenance_count
=
len
(
HelpdeskTicket
.
search
(
domain
)
.
filtered
(
lambda
h
:
h
.
team_id
.
id
==
request
.
env
.
ref
(
'helpdesk_maintenance.maintenance'
)
.
id
and
h
.
maintenance_type_id
.
id
==
request
.
env
.
ref
(
'helpdesk_maintenance.emergency'
.
id
)))
# pager
pager
=
portal_pager
(
url
=
"/my/mantenimientos/emergencias"
,
url_args
=
{
'sortby'
:
sortby
,
'search_in'
:
search_in
,
'search'
:
search
,
'filterby'
:
filterby
},
total
=
maintenance_count
,
page
=
page
,
step
=
self
.
_items_per_page
)
if
groupby
==
'create_by'
:
...
...
@@ -712,6 +699,11 @@ class PortalCustomerMaintenence(CustomerPortal):
order
=
"priority,
%
s"
%
order
elif
groupby
==
'state'
:
order
=
'state,
%
s'
%
order
elif
groupby
==
'maintenance_type'
:
order
=
"maintenance_type_id,
%
s"
%
order
elif
groupby
==
'severity_type'
:
order
=
"severity_type,
%
s"
%
order
tickets
=
HelpdeskTicket
.
search
(
domain
,
order
=
order
,
limit
=
self
.
_items_per_page
,
offset
=
pager
[
'offset'
])
request
.
session
[
'my_tickets_history'
]
=
tickets
.
ids
[:
100
]
...
...
@@ -760,6 +752,16 @@ class PortalCustomerMaintenence(CustomerPortal):
HelpdeskTicket
.
concat
(
*
g
)
for
k
,
g
in
groupbyelem
(
tickets
,
itemgetter
(
'state'
))
]
elif
groupby
==
'maintenance_type'
:
grouped_tickets
=
[
HelpdeskTicket
.
concat
(
*
g
)
for
k
,
g
in
groupbyelem
(
tickets
,
itemgetter
(
'maintenance_type_id'
))
]
elif
groupby
==
'severity_type'
:
grouped_tickets
=
[
HelpdeskTicket
.
concat
(
*
g
)
for
k
,
g
in
groupbyelem
(
tickets
,
itemgetter
(
'severity_type'
))
]
# content according to pager and archive selected
values
.
update
({
'created'
:
ctr
,
...
...
@@ -796,13 +798,7 @@ class PortalCustomerMaintenence(CustomerPortal):
if
not
partner_id
:
return
json
.
dumps
({
"resp"
:
"Error"
,
"message"
:
"Colaborador no encontrado, favor de verificar que haya agregado uno"
})
if
partner_id
:
unvalued_tickets
=
len
(
request
.
env
[
'helpdesk.ticket'
]
.
sudo
()
.
search
([
(
'stage_id'
,
'='
,
request
.
env
.
ref
(
'sh_all_in_one_helpdesk.done_stage'
)
.
id
),
(
'priority_new'
,
'='
,
False
)])
)
if
unvalued_tickets
>=
3
:
return
json
.
dumps
({
"resp"
:
"Error"
,
"message"
:
"Tienes demasiados tickets sin evaluar, favor de evaluarlos"
})
ticket_dic
=
{
'partner_id'
:
partner_id
.
id
,
'ticket_from_portal'
:
True
...
...
@@ -825,7 +821,6 @@ class PortalCustomerMaintenence(CustomerPortal):
'email'
:
kw
.
get
(
'portal_email'
),
})
team_id
=
request
.
env
[
'helpdesk.team'
]
.
sudo
()
.
browse
(
request
.
env
.
ref
(
'helpdesk_maintenance.maintenance'
)
.
id
)
if
team_id
:
ticket_dic
.
update
({
...
...
@@ -845,8 +840,9 @@ class PortalCustomerMaintenence(CustomerPortal):
})
if
kw
.
get
(
'portal_date_fail'
):
ticket_dic
.
update
({
'date_fail'
:
datetime
.
strptime
(
kw
.
get
(
'portal_date_fail'
),
FORMAT
)
.
date
(),
'date_fail'
:
datetime
.
strptime
(
kw
.
get
(
'portal_date_fail'
),
"
%
d-
%
m-
%
Y"
)
.
date
(),
})
if
kw
.
get
(
'portal_fail_type'
):
...
...
@@ -878,7 +874,7 @@ class PortalCustomerMaintenence(CustomerPortal):
except
Exception
as
e
:
_logger
.
exception
(
'Something went wrong
%
s'
,
str
(
e
))
@http.route
([
'/my/manteniminetos/emergencias/<int:ticket_id>'
],
type
=
'http'
,
auth
=
"public"
,
website
=
True
)
"""
@http.route(['/my/manteniminetos/emergencias/<int:ticket_id>'],type='http',auth="public",website=True)
def portal_my_ticket_detail_maintenance_emergency(self,ticket_id,access_token=None,report_type=None,message=False,download=False,**kw):
try:
ticket_sudo = self._document_check_access('helpdesk.ticket', ticket_id, access_token=access_token)
...
...
@@ -900,12 +896,12 @@ class PortalCustomerMaintenence(CustomerPortal):
)
values = {
'token': access_token,
'm
_emergency
'
:
ticket_sudo
,
'm
aintenance
': ticket_sudo,
'message': message,
'bootstrap_formatting': True,
'partner_id': ticket_sudo.partner_id.id,
'report_type': 'html',
}
return
request
.
render
(
"helpdesk_maintenance.portal_ticket_page_maintenance_emergency"
,
values
)
return request.render("helpdesk_maintenance.portal_ticket_page_maintenance_emergency",values)
"""
\ No newline at end of file
This diff is collapsed.
Click to expand it.
helpdesk_maintenance/data/helpdesk_team.xml
View file @
3f72f378
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data
noupdate=
"
1
"
>
<data
noupdate=
"
0
"
>
<record
id=
"maintenance"
model=
"helpdesk.team"
>
<field
name=
"name"
>
Mantenimiento
</field>
<field
name=
"short_name"
>
MAN
</field>
...
...
@@ -8,6 +8,14 @@
<field
name=
"sh_resource_calendar_id"
ref=
"resource.resource_calendar_std"
/>
<field
name=
"is_maintenance_team"
eval=
"True"
/>
</record>
<!--<record id="maintenance_emergency" model="helpdesk.team">
<field name="name">Mantenimiento Emergencias</field>
<field name="short_name">MAN911</field>
<field name="team_head" ref="base.user_admin"/>
<field name="sh_resource_calendar_id" ref="resource.resource_calendar_std"/>
<field name="is_maintenance_team" eval="True"/>
</record>-->
</data>
</odoo>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
helpdesk_maintenance/data/maintenance_type.xml
View file @
3f72f378
...
...
@@ -25,7 +25,7 @@
<field
name=
"name"
>
Plomeria (baños y comedor)
</field>
</record>
<record
id=
"emergency"
model=
"maintenance.type"
>
<field
name=
"name"
>
Urgencia (comprometa la seguridad física o patrimonial
</field>
<field
name=
"name"
>
Urgencia (comprometa la seguridad física o patrimonial
)
</field>
</record>
</data>
...
...
This diff is collapsed.
Click to expand it.
helpdesk_maintenance/models/helpdesk_ticket.py
View file @
3f72f378
...
...
@@ -30,8 +30,6 @@ class HelpdeskTicket(models.Model):
for
ticket
in
self
:
if
ticket
.
team_id
.
id
==
self
.
env
.
ref
(
'helpdesk_maintenance.maintenance'
)
.
id
:
ticket
.
access_url
=
'/my/manteniminetos/
%
s'
%
(
ticket
.
id
)
if
ticket
.
team_id
.
id
==
self
.
env
.
ref
(
'helpdesk_maintenance.maintenance'
)
.
id
and
ticket
.
maintenance_type_id
.
id
==
self
.
env
.
ref
(
'helpdesk_maintenance.emergency'
)
.
id
:
ticket
.
access_url
=
'/my/manteniminetos/emergencias/
%
s'
%
(
ticket
.
id
)
@api.depends
(
'team_id'
)
def
_verify_ticket_type
(
self
):
...
...
This diff is collapsed.
Click to expand it.
helpdesk_maintenance/static/src/js/portal.js
View file @
3f72f378
$
(
document
).
ready
(
function
(
e
)
{
$
(
"#portal_date_fail"
).
datepicker
();
$
(
"#new_request"
).
click
(
function
()
{
$
(
"#createticketModalMaintenance"
).
modal
(
"show"
);
});
$
(
"#portal_date_fail"
).
datepicker
({
dateFormat
:
'dd-mm-yy'
});
//verify_date();
$
(
"#form_id"
).
submit
(
function
(
e
){
var
ticket_type
=
$
(
"#tck_type"
).
val
();
if
(
ticket_type
==
"mantenimiento"
){
var
req
=
required_maintenance
()
console
.
log
(
req
)
if
(
req
[
'portal_contact_name'
]
==
""
){
e
.
preventDefault
();
show_error
(
"Es necesario llenar el campo de Nombre"
);
...
...
@@ -26,7 +33,7 @@ $(document).ready(function(e) {
e
.
preventDefault
();
show_error
(
"Es necesario llenar el campo de Fecha de Falla"
);
}
if
(
req
[
'portal_severity'
]
==
""
){
if
(
req
[
'portal_severity'
]
==
false
){
e
.
preventDefault
();
show_error
(
"Es necesario llenar el campo de Tipo de Gravedad"
);
}
...
...
@@ -34,18 +41,18 @@ $(document).ready(function(e) {
e
.
preventDefault
();
show_error
(
"Es necesario llenar el campo de Descripción"
);
}
if
(
req
[
'portal_fail_type'
]
==
""
){
if
(
req
[
'portal_fail_type'
]
==
false
){
e
.
preventDefault
();
show_error
(
"Es necesario llenar el campo de Tipo de Falla"
);
}
if
(
req
[
'portal_file'
]
==
0
){
e
.
preventDefault
();
show_error
(
"Es necesario agregar los archivos de evidencia
|
"
);
show_error
(
"Es necesario agregar los archivos de evidencia"
);
}
}
if
(
ticket_type
==
"emergencia_mantenimiento"
){
var
req
=
required_maintenance
()
var
req
=
required_maintenance
_emergency
()
if
(
req
[
'portal_contact_name'
]
==
""
){
e
.
preventDefault
();
show_error
(
"Es necesario llenar el campo de Nombre"
);
...
...
@@ -68,7 +75,7 @@ $(document).ready(function(e) {
e
.
preventDefault
();
show_error
(
"Es necesario llenar el campo de Descripción"
);
}
if
(
req
[
'portal_fail_type'
]
==
""
){
if
(
req
[
'portal_fail_type'
]
==
false
){
e
.
preventDefault
();
show_error
(
"Es necesario llenar el campo de Tipo de Falla"
);
}
...
...
@@ -89,9 +96,9 @@ $(document).ready(function(e) {
'portal_phone'
:
$
(
"#portal_phone"
).
val
(),
'portal_main_type'
:
$
(
"#portal_main_type"
).
val
(),
'portal_date_fail'
:
$
(
"#portal_date_fail"
).
val
(),
'portal_severity'
:
$
(
"#portal_severity"
).
val
(
),
'portal_severity'
:
$
(
"#portal_severity"
).
is
(
':checked'
),
'portal_description'
:
$
(
"#portal_description"
).
val
(),
'portal_fail_type'
:
$
(
"#portal_fail_type"
).
val
(
),
'portal_fail_type'
:
$
(
"#portal_fail_type"
).
is
(
':checked'
),
'portal_file'
:
document
.
getElementById
(
'portal_file'
).
files
.
length
}
}
...
...
@@ -104,7 +111,7 @@ $(document).ready(function(e) {
'portal_phone'
:
$
(
"#portal_phone"
).
val
(),
'portal_date_fail'
:
$
(
"#portal_date_fail"
).
val
(),
'portal_description'
:
$
(
"#portal_description"
).
val
(),
'portal_fail_type'
:
$
(
"#portal_fail_type"
).
val
(
),
'portal_fail_type'
:
$
(
"#portal_fail_type"
).
is
(
':checked'
),
'portal_file'
:
document
.
getElementById
(
'portal_file'
).
files
.
length
}
}
...
...
This diff is collapsed.
Click to expand it.
helpdesk_maintenance/views/portal_emergency.xml
View file @
3f72f378
...
...
@@ -12,7 +12,7 @@
<input
type=
"hidden"
name=
"mdl_shw"
id=
"mdl_shw"
t-att-value=
"created"
/>
<div
id=
"createticketModal"
class=
"modal fade"
role=
"dialog"
>
<div
id=
"createticketModal
Maintenance
"
class=
"modal fade"
role=
"dialog"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-content"
style=
"max-height:650px;"
>
<div
class=
"modal-body"
>
...
...
@@ -60,10 +60,12 @@
<input
type=
"text"
class=
"form-control form-field s_website_form_required"
id=
"portal_phone"
name=
"portal_phone"
required=
""
/>
</div>
<!--fecha de decteción de falla-->
<div
t-attf-class=
"form-group o_website_form_required_custom #{error and 'portal_date_fail' in error and 'has-error' or ''}"
>
<label
class=
"control-label"
for=
"portal_date_fail"
>
¿Cuando detecto la falla?
</label>
<input
type=
"text"
class=
"form-control form-field s_website_form_required"
id=
"portal_date_fail"
name=
"portal_date_fail"
placeholder=
"(dd/mm/yyyy)"
required=
""
/>
<input
type=
"text"
class=
"form-control form-field s_website_form_required"
id=
"portal_date_fail"
name=
"portal_date_fail"
required=
""
/>
</div>
<!--Descripción detallada de falla-->
...
...
@@ -86,6 +88,7 @@
<span
class=
"custom-file-control"
/>
</label>
</div>
<div
class=
"row mb-2"
>
<div
class=
"col-12 text-center border-top "
>
<button
type=
"submit"
id=
"create_helpdesk_ticket"
class=
"btn btn-primary mt-2 rounded"
>
Crear Ticket
</button>
...
...
@@ -131,9 +134,18 @@
<em
class=
"font-weight-normal text-muted"
>
Estatus de Respuesta:
</em>
<span
t-esc=
"ticket[0].state"
/>
</th>
<th
t-if=
"groupby == 'maintenance_type'"
>
<em
class=
"font-weight-normal text-muted"
>
Tipo de mantenimiento:
</em>
<span
t-esc=
"ticket[0].maintenance_type_id.name"
/>
</th>
<th
t-if=
"groupby == 'severity_type'"
>
<em
class=
"font-weight-normal text-muted"
>
Gravedad:
</em>
<span
t-esc=
"ticket[0].severity_type"
/>
</th>
<th>
Fecha de creación
</th>
<th>
Última actualización
</th>
<th>
Tipo de Ticket
</th>
<th>
Tipo de mantenimiento
</th>
<th>
Gravedad
</th>
<th>
Tipo de falla
</th>
<th>
Estado
</th>
</tr>
</thead>
...
...
@@ -147,8 +159,9 @@
</a>
</td>
<td><span
t-field=
"t.create_date"
t-options=
'{"widget": "date"}'
/></td>
<td><span
t-field=
"t.write_date"
t-options=
'{"widget": "date"}'
/></td>
<td><span
t-field=
"t.ticket_type"
/></td>
<td><span
t-field=
"t.maintenance_type_id"
/></td>
<td><span
t-field=
"t.severity_type"
/></td>
<td><span
t-field=
"t.fail_type"
/></td>
<td><span
t-field=
"t.stage_id"
/></td>
</tr>
</t>
...
...
This diff is collapsed.
Click to expand it.
helpdesk_maintenance/views/portal_maintenance.xml
View file @
3f72f378
...
...
@@ -148,9 +148,18 @@
<em
class=
"font-weight-normal text-muted"
>
Estatus de Respuesta:
</em>
<span
t-esc=
"ticket[0].state"
/>
</th>
<th
t-if=
"groupby == 'maintenance_type'"
>
<em
class=
"font-weight-normal text-muted"
>
Tipo de mantenimiento:
</em>
<span
t-esc=
"ticket[0].maintenance_type_id.name"
/>
</th>
<th
t-if=
"groupby == 'severity_type'"
>
<em
class=
"font-weight-normal text-muted"
>
Gravedad:
</em>
<span
t-esc=
"ticket[0].severity_type"
/>
</th>
<th>
Fecha de creación
</th>
<th>
Última actualización
</th>
<th>
Tipo de Ticket
</th>
<th>
Tipo de mantenimiento
</th>
<th>
Gravedad
</th>
<th>
Tipo de falla
</th>
<th>
Estado
</th>
</tr>
</thead>
...
...
@@ -164,8 +173,9 @@
</a>
</td>
<td><span
t-field=
"t.create_date"
t-options=
'{"widget": "date"}'
/></td>
<td><span
t-field=
"t.write_date"
t-options=
'{"widget": "date"}'
/></td>
<td><span
t-field=
"t.ticket_type"
/></td>
<td><span
t-field=
"t.maintenance_type_id"
/></td>
<td><span
t-field=
"t.severity_type"
/></td>
<td><span
t-field=
"t.fail_type"
/></td>
<td><span
t-field=
"t.stage_id"
/></td>
</tr>
</t>
...
...
This diff is collapsed.
Click to expand it.
helpdesk_maintenance/views/portal_my.xml
View file @
3f72f378
...
...
@@ -12,14 +12,16 @@
<template
id=
"portal_my_home_menu_ticket"
name=
"Portal layout : ticket menu entries"
inherit_id=
"portal.portal_breadcrumbs"
priority=
"60"
>
<xpath
expr=
"//ol[hasclass('o_portal_submenu')]"
position=
"inside"
>
<li
t-if=
"page_name == 'maintenance' or maintenance"
t-attf-class=
"breadcrumb-item #{'active ' if not soporte else ''}"
>
<a
t-if=
"maintenance"
t-attf-href=
"/my/mantenimientos?{{ keep_query() }}"
>
Mantenimiento
</a>
<t
t-else=
""
>
Mantenimiento
</t>
</li>
<li
t-if=
"maintenance"
class=
"breadcrumb-item active"
>
<t
t-esc=
"maintenance.name"
t-if=
"maintenance
.name
"
/>
<t
t-esc=
"maintenance.name"
t-if=
"maintenance"
/>
<t
t-else=
""
><em>
Mantenimiento
</em></t>
</li>
<li
t-if=
"page_name == 'm_emergency' or m_emergency"
t-attf-class=
"breadcrumb-item #{'active ' if not soporte else ''}"
>
<a
t-if=
"m_emergency"
t-attf-href=
"/my/mantienimiento/emergencia?{{ keep_query() }}"
>
Emergencia
</a>
<t
t-else=
""
>
Emergencia
</t>
...
...
@@ -28,6 +30,7 @@
<t
t-esc=
"maintenance.name"
t-if=
"maintenance.name"
/>
<t
t-else=
""
><em>
Mantenimiento
</em></t>
</li>
</xpath>
</template>
...
...
This diff is collapsed.
Click to expand it.
other_odoo_login/controllers/main.py
View file @
3f72f378
...
...
@@ -20,8 +20,8 @@ class HomeInherit(Home):
if
'login'
in
kw
and
'password'
in
kw
:
usr
=
request
.
env
[
'res.users'
]
.
sudo
()
.
search
([(
'login'
,
'='
,
kw
[
'login'
])],
limit
=
1
)
if
usr
.
verification_odoo
:
response
=
self
.
auth_user_rpc
(
kw
[
'login'
],
kw
[
'password'
])
if
response
[
'uid'
]
!=
0
:
uid
=
self
.
auth_user_rpc
(
kw
[
'login'
],
kw
[
'password'
])
if
uid
!=
0
:
return
super
(
HomeInherit
,
self
)
.
web_login
(
redirect
=
redirect
,
**
kw
)
else
:
return
request
.
redirect
(
'/web/login?error=access'
)
...
...
@@ -30,24 +30,15 @@ class HomeInherit(Home):
else
:
return
super
(
HomeInherit
,
self
)
.
web_login
(
redirect
=
redirect
,
**
kw
)
def
bearer_token
(
self
,
url
):
rqst
=
requests
.
post
(
url
+
"t06k3n/"
,
data
=
{
"uu89ieor18u"
:
USER
,
"2dpsonid45p"
:
PASSW
}
)
response
=
rqst
.
json
()
return
response
[
't0k3n'
]
def
auth_user_rpc
(
self
,
username
,
password
):
company
=
request
.
env
[
'res.company'
]
.
sudo
()
.
search
([],
limit
=
1
)
url
=
company
.
login_url
+
"/api/v1/"
rqst
=
requests
.
get
(
url
+
"helpdeskuser/"
,
headers
=
{
'Authorization'
:
'Bearer '
+
self
.
bearer_token
(
url
)},
data
=
{
"user"
:
username
,
"password"
:
password
}
)
return
rqst
.
json
()
uid
=
0
companies_url
=
request
.
env
[
'res.company'
]
.
sudo
()
.
search
([])
.
filtered
(
lambda
c
:
c
.
login_url
and
c
.
login_db
)
if
companies_url
:
for
c
in
companies_url
:
common
=
xmlrpc
.
client
.
ServerProxy
(
c
.
login_url
+
"/xmlrpc/2/common"
)
uid
=
common
.
authenticate
(
c
.
login_db
,
username
,
password
,{})
if
uid
!=
0
:
break
return
uid
This diff is collapsed.
Click to expand it.
other_odoo_login/models/res_company.py
View file @
3f72f378
from
odoo
import
models
,
fields
,
api
,
_
from
odoo.exceptions
import
UserError
import
requests
USER
=
"helpdesk"
PASSW
=
"12345"
class
ResCompany
(
models
.
Model
):
_inherit
=
'res.company'
login_url
=
fields
.
Char
(
'URL'
)
login_db
=
fields
.
Char
(
'Base de Datos'
)
def
test_conn
(
self
):
url
=
self
.
login_url
+
"/api/v1/"
request
=
requests
.
post
(
url
+
"t06k3n/"
,
data
=
{
"uu89ieor18u"
:
USER
,
"2dpsonid45p"
:
PASSW
}
)
response
=
request
.
json
()
if
response
[
't0k3n'
]:
pass
else
:
raise
UserError
(
'CONEXIÓN ERRONEA'
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment