Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Maria Agustina
/
hgt_incidencias
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit 817989db
authored
2021-01-30 21:18:29 -0300
by
adrian
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
configuraccion y usabilidad
1 parent
cd2ca6f4
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
120 additions
and
16 deletions
__manifest__.py
models/__init__.py
models/configuracion.py
models/incidencias.py
security/ir.model.access.csv
security/permisos.xml
views/configuracion.xml
views/menu.xml
__manifest__.py
View file @
817989d
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
# Check https://github.com/odoo/odoo/blob/master/odoo/addons/base/module/module_data.xml
# Check https://github.com/odoo/odoo/blob/master/odoo/addons/base/module/module_data.xml
# for the full list
# for the full list
'category'
:
'Uncategorized'
,
'category'
:
'Uncategorized'
,
'version'
:
'0.2
0.12.02
'
,
'version'
:
'0.2
1.01.29
'
,
# any module necessary for this one to work correctly
# any module necessary for this one to work correctly
'depends'
:
[
'base'
,
'depends'
:
[
'base'
,
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
'security/permisos.xml'
,
'security/permisos.xml'
,
'security/ir.model.access.csv'
,
'security/ir.model.access.csv'
,
'views/incidencias.xml'
,
'views/incidencias.xml'
,
'views/configuracion.xml'
,
'views/menu.xml'
,
'views/menu.xml'
,
],
],
...
...
models/__init__.py
View file @
817989d
...
@@ -4,3 +4,4 @@ from . import incidencias
...
@@ -4,3 +4,4 @@ from . import incidencias
from
.
import
reporte
from
.
import
reporte
from
.
import
cliente
from
.
import
cliente
from
.
import
estados
from
.
import
estados
from
.
import
configuracion
\ No newline at end of file
\ No newline at end of file
models/configuracion.py
0 → 100644
View file @
817989d
# -*- coding: utf-8 -*-
from
odoo.exceptions
import
UserError
from
odoo
import
models
,
fields
,
api
import
requests
,
time
class
hgt_coniguracion_incidencias
(
models
.
Model
):
_name
=
'hgt.coniguracion_incidencias'
_order
=
"id desc"
habilitado
=
fields
.
Boolean
(
string
=
'Habilitado'
,
default
=
False
)
name
=
fields
.
Char
(
string
=
'Nombre de perfil'
)
dispacher
=
fields
.
Many2one
(
comodel_name
=
'res.users'
,
string
=
'Dispacher'
)
url_ost
=
fields
.
Boolean
(
string
=
'Agregar url a bitacora'
)
@api.onchange
(
'habilitado'
)
def
_onchange_habilitado
(
self
):
configs
=
self
.
env
[
'hgt.coniguracion_incidencias'
]
.
search
([[
"id"
,
"!="
,
self
.
_origin
.
id
],
[
"habilitado"
,
"="
,
True
]])
if
(
self
.
habilitado
==
False
)
and
(
len
(
configs
)
==
0
):
self
.
habilitado
=
True
if
self
.
habilitado
==
True
:
for
conf
in
configs
:
conf
.
write
({
"habilitado"
:
False
})
def
confirm
(
self
):
print
(
self
.
id
)
self
.
habilitado
=
True
configs
=
self
.
env
[
'hgt.coniguracion_incidencias'
]
.
search
([[
"id"
,
"!="
,
self
.
id
],
[
"habilitado"
,
"="
,
True
]])
for
conf
in
configs
:
conf
.
write
({
"habilitado"
:
False
})
\ No newline at end of file
\ No newline at end of file
models/incidencias.py
View file @
817989d
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from
odoo.exceptions
import
UserError
from
odoo
import
models
,
fields
,
api
from
odoo
import
models
,
fields
,
api
import
requests
import
requests
class
hgt_incidencias
(
models
.
Model
):
class
hgt_incidencias
(
models
.
Model
):
...
@@ -90,13 +90,14 @@ class hgt_incidencias(models.Model):
...
@@ -90,13 +90,14 @@ class hgt_incidencias(models.Model):
tiempo_carga
=
fields
.
Integer
(
string
=
'Tiempo utilizado'
,
default
=
30
)
tiempo_carga
=
fields
.
Integer
(
string
=
'Tiempo utilizado'
,
default
=
30
)
def
generar_tareas
(
self
):
def
generar_tareas
(
self
):
iden
=
self
.
id
#import ipdb; ipdb.set_trace()
datos
=
{
if
(
len
(
self
.
asignador
)
==
0
):
'resumen'
:
'Incidencia {} {}'
.
format
(
iden
,
self
.
ost_asunto
),
raise
UserError
(
"""Esta creando una tarea nula.
La tarea tiene que tener ejecutante."""
)
datos
=
{
'resumen'
:
'Incidencia {} OST {} {}'
.
format
(
self
.
id
,
self
.
numero
,
self
.
ost_asunto
),
'descripcion'
:
self
.
texto_descripcion
,
'descripcion'
:
self
.
texto_descripcion
,
'ejecutor'
:
self
.
asignador
.
id
,
'ejecutor'
:
self
.
asignador
.
id
,
'minutos_reales'
:
self
.
tiempo_carga
'minutos_reales'
:
self
.
tiempo_carga
}
}
nueva_tar
=
self
.
env
[
'hgt.tarea'
]
.
create
(
datos
)
nueva_tar
=
self
.
env
[
'hgt.tarea'
]
.
create
(
datos
)
self
.
asignador
=
False
self
.
asignador
=
False
self
.
texto_descripcion
=
False
self
.
texto_descripcion
=
False
...
@@ -124,14 +125,22 @@ class hgt_incidencias(models.Model):
...
@@ -124,14 +125,22 @@ class hgt_incidencias(models.Model):
@api.model
@api.model
def
create
(
self
,
vals
):
def
create
(
self
,
vals
):
dom
=
[]
dom
=
[]
#cant = self.env['hgt.incidencias'].search_count(dom)
config
=
self
.
env
[
'hgt.coniguracion_incidencias'
]
.
search
([[
"habilitado"
,
"="
,
True
]])
#iden= cant + 1
try
:
idem
=
self
.
id
datos
=
{
'resumen'
:
'Incidencia OST {} {}'
.
format
(
vals
[
'numero'
],
vals
[
'ost_asunto'
]),
'descripcion'
:
vals
[
'descripcion'
],
datos
=
{
'ejecutor'
:
config
.
dispacher
.
id
,
'resumen'
:
'Incidencia {} {}'
.
format
(
iden
,
vals
[
'ost_asunto'
]),
'origen'
:
"Incidentes"
,}
'descripcion'
:
vals
[
'descripcion'
]
if
config
.
url_ost
==
True
:
}
datos
[
'notitas'
]
=
vals
[
'url'
]
if
(
vals
[
'numero'
]
==
False
)
or
(
vals
[
'numero'
]
==
""
):
raise
()
except
:
num
=
self
.
search_count
([])
+
1
#num = 1
datos
=
{
'resumen'
:
'Incidencia local {} '
.
format
(
num
),
'origen'
:
"Incidentes"
,
'ejecutor'
:
config
.
dispacher
.
id
}
vals
[
'numero'
]
=
"INC {}"
.
format
(
num
)
print
(
datos
)
nueva_tar
=
self
.
env
[
'hgt.tarea'
]
.
create
(
datos
)
nueva_tar
=
self
.
env
[
'hgt.tarea'
]
.
create
(
datos
)
try
:
try
:
if
vals
[
'accion'
]:
if
vals
[
'accion'
]:
...
...
security/ir.model.access.csv
View file @
817989d
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_hgt_incidencias,access_hgt_incidencias,model_hgt_incidencias,group_crm_incidentes,1,1,1,0
access_hgt_incidencias,access_hgt_incidencias,model_hgt_incidencias,group_crm_incidentes,1,1,1,0
access_hgt_coniguracion_incidencias,access_hgt_coniguracion_incidencias,model_hgt_coniguracion_incidencias,group_crm_incidentesconf,1,1,0,0
\ No newline at end of file
\ No newline at end of file
security/permisos.xml
View file @
817989d
...
@@ -11,5 +11,10 @@
...
@@ -11,5 +11,10 @@
<field
name=
"category_id"
eval=
"ref('category_hgt_incidente')"
/>
<field
name=
"category_id"
eval=
"ref('category_hgt_incidente')"
/>
</record>
</record>
<record
model=
"res.groups"
id=
"group_crm_incidentesconf"
>
<field
name=
"name"
>
Configurador
</field>
<field
name=
"category_id"
eval=
"ref('category_hgt_incidente')"
/>
</record>
</data>
</data>
</openerp>
</openerp>
\ No newline at end of file
\ No newline at end of file
views/configuracion.xml
0 → 100644
View file @
817989d
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data
noupdate=
"0"
>
<record
id=
"action_incidenciasconfig_act_window"
model=
"ir.actions.act_window"
>
<field
name=
"type"
>
ir.actions.act_window
</field>
<field
name=
"name"
>
Incidencias
</field>
<field
name=
"res_model"
>
hgt.coniguracion_incidencias
</field>
<field
name=
"view_mode"
>
tree,form
</field>
<field
name=
"view_type"
>
form
</field>
<field
name=
"target"
>
current
</field>
</record>
<record
id=
"view_incidenciasconfig_tree"
model=
"ir.ui.view"
>
<field
name=
"name"
>
Incidencias
</field>
<field
name=
"model"
>
hgt.coniguracion_incidencias
</field>
<field
name=
"type"
>
tree
</field>
<field
name=
"mode"
>
primary
</field>
<field
name=
"priority"
eval=
"16"
/>
<field
name=
"active"
eval=
"True"
/>
<field
name=
"arch"
type=
"xml"
>
<tree>
<field
name=
"name"
/>
<field
name=
"habilitado"
widget=
"Radio"
attrs=
"{'readonly': True}"
/>
<button
type=
"object"
name=
"confirm"
string=
"Confirm"
class=
"oe_highlight"
/>
</tree>
</field>
</record>
<record
id=
"view_incidenciasconfig_form"
model=
"ir.ui.view"
>
<field
name=
"name"
>
Incidencias
</field>
<field
name=
"model"
>
hgt.coniguracion_incidencias
</field>
<field
name=
"type"
>
form
</field>
<field
name=
"mode"
>
primary
</field>
<field
name=
"priority"
eval=
"16"
/>
<field
name=
"active"
eval=
"True"
/>
<field
name=
"arch"
type=
"xml"
>
<form>
<sheet>
<group
col=
"4"
string=
"Incidencia"
>
<field
name=
"name"
/>
<field
name=
"habilitado"
widget=
"boolean_toggle"
/>
<field
name=
"dispacher"
/>
<field
name=
"url_ost"
/>
</group>
</sheet>
</form>
</field>
</record>
</data>
</odoo>
\ No newline at end of file
\ No newline at end of file
views/menu.xml
View file @
817989d
...
@@ -6,6 +6,6 @@
...
@@ -6,6 +6,6 @@
<menuitem
name=
"Incidencias"
id=
"hgt_incidencias_incidencias"
parent=
"asw_crm.asw_crm_root"
/>
<menuitem
name=
"Incidencias"
id=
"hgt_incidencias_incidencias"
parent=
"asw_crm.asw_crm_root"
/>
<menuitem
name=
"Ver Incidencias"
parent=
"hgt_incidencias_incidencias"
id=
"hgt_incidencias_accion"
action=
"action_incidencias_act_window"
/>
<menuitem
name=
"Ver Incidencias"
parent=
"hgt_incidencias_incidencias"
id=
"hgt_incidencias_accion"
action=
"action_incidencias_act_window"
/>
<menuitem
name=
"Configuracion incidencia"
parent=
"hgt_incidencias_incidencias"
id=
"hgt_conf_incidencias_accion"
action=
"action_incidenciasconfig_act_window"
/>
</data>
</data>
</odoo>
</odoo>
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment