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
Apr 05, 2023
by
Arturo Jasso Origel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restableciendo cambios de other_odoo_login
parent
5d9ba670
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
79 additions
and
64 deletions
+79
-64
helpdesk_maintenance/controllers/portal.py
+0
-0
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
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
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>
...
...
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
):
...
...
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
}
}
...
...
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>
...
...
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>
...
...
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>
...
...
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
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
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