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 df0046d3
authored
2020-12-08 13:03:34 -0300
by
Maria Agustina
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
228 terminada
1 parent
9b60231d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
54 additions
and
16 deletions
models/__pycache__/cliente.cpython-36.pyc
models/__pycache__/estados.cpython-36.pyc
models/__pycache__/incidencias.cpython-36.pyc
models/cliente.py
models/estados.py
models/incidencias.py
views/incidencias.xml
models/__pycache__/cliente.cpython-36.pyc
View file @
df0046d
No preview for this file type
models/__pycache__/estados.cpython-36.pyc
View file @
df0046d
No preview for this file type
models/__pycache__/incidencias.cpython-36.pyc
View file @
df0046d
No preview for this file type
models/cliente.py
View file @
df0046d
...
@@ -5,3 +5,10 @@ from odoo import models, fields, api
...
@@ -5,3 +5,10 @@ from odoo import models, fields, api
class
hgt_cliente
(
models
.
Model
):
class
hgt_cliente
(
models
.
Model
):
_name
=
'hgt.cliente'
_name
=
'hgt.cliente'
_inherit
=
'asw.cliente'
#es con este cliente con el que queremos relacionar?
_inherit
=
'asw.cliente'
#es con este cliente con el que queremos relacionar?
incidencia
=
fields
.
One2many
(
string
=
'Incidencia'
,
comodel_name
=
'hgt.incidencias'
,
inverse_name
=
'cliente'
,
)
models/estados.py
View file @
df0046d
...
@@ -4,4 +4,11 @@ from odoo import models, fields, api
...
@@ -4,4 +4,11 @@ from odoo import models, fields, api
class
hgt_estados
(
models
.
Model
):
class
hgt_estados
(
models
.
Model
):
_name
=
'hgt.estados'
_name
=
'hgt.estados'
inherit
=
'hgt.accionestados'
#ver si es con estos estads con los que se quiere relacionar
\ No newline at end of file
\ No newline at end of file
inherit
=
'hgt.accionestados'
#ver si es con estos estads con los que se quiere relacionar
incidencia
=
fields
.
One2many
(
string
=
'Incidencia'
,
comodel_name
=
'hgt.incidencias'
,
inverse_name
=
'estado'
,
)
\ No newline at end of file
\ No newline at end of file
models/incidencias.py
View file @
df0046d
...
@@ -10,15 +10,17 @@ class hgt_incidencias(models.Model):
...
@@ -10,15 +10,17 @@ class hgt_incidencias(models.Model):
selection
=
[(
'pro'
,
'Propia'
),
(
'ter'
,
'Tercero'
),
(
'cli'
,
'Cliente'
),
(
'cat'
,
'Catástrofe'
)]
selection
=
[(
'pro'
,
'Propia'
),
(
'ter'
,
'Tercero'
),
(
'cli'
,
'Cliente'
),
(
'cat'
,
'Catástrofe'
)]
)
)
responsable
=
fields
.
Many2one
(
'res.users'
,
string
=
'Responsable'
,
index
=
True
,
default
=
lambda
self
:
self
.
env
.
user
)
reporte
=
fields
.
Many2one
(
reporte
=
fields
.
Many2one
(
string
=
'Reporte'
,
string
=
'Reporte'
,
comodel_name
=
'hgt
_
reporte'
,
comodel_name
=
'hgt
.
reporte'
,
ondelete
=
'restrict'
,
ondelete
=
'restrict'
,
)
)
cliente
=
fields
.
Many2one
(
cliente
=
fields
.
Many2one
(
string
=
'Cliente'
,
string
=
'Cliente'
,
comodel_name
=
'hgt
_
cliente'
,
comodel_name
=
'hgt
.
cliente'
,
ondelete
=
'restrict'
,
ondelete
=
'restrict'
,
)
)
...
@@ -33,7 +35,7 @@ class hgt_incidencias(models.Model):
...
@@ -33,7 +35,7 @@ class hgt_incidencias(models.Model):
estado
=
fields
.
Many2one
(
estado
=
fields
.
Many2one
(
string
=
'Estados'
,
string
=
'Estados'
,
comodel_name
=
'hgt
_
estados'
,
comodel_name
=
'hgt
.
estados'
,
ondelete
=
'restrict'
,
ondelete
=
'restrict'
,
)
)
...
@@ -50,15 +52,41 @@ class hgt_incidencias(models.Model):
...
@@ -50,15 +52,41 @@ class hgt_incidencias(models.Model):
)
)
accion
=
fields
.
Many2one
(
accion
=
fields
.
Many2one
(
string
=
u
'Acción'
,
string
=
'Acción'
,
comodel_name
=
'hgt.acciones'
,
comodel_name
=
'hgt.acciones'
,
ondelete
=
'restrict'
,
ondelete
=
'restrict'
,
)
)
#metodo
@api.onchange
(
'proyecto'
)
# Cada incidencia/cliente genera una Tarea
def
onchange_campo
(
self
):
# puede relacionarse con proyecto
result
=
{}
# puede relacionarse con proyectto accion
result
[
'domain'
]
=
[]
if
self
.
proyecto
:
ids
=
self
.
proyecto
.
acciones
.
ids
result
[
'domain'
]
=
{
'accion'
:
[(
'id'
,
'in'
,
ids
)]}
return
result
@api.model
def
create
(
self
,
vals
):
dom
=
[]
cant
=
self
.
env
[
'hgt.incidencias'
]
.
search_count
(
dom
)
iden
=
cant
+
1
datos
=
{
'resumen'
:
'Tarea para resolver Incidencia {}'
.
format
(
iden
),
'descripcion'
:
vals
[
'descripcion'
]
}
nueva_tar
=
self
.
env
[
'hgt.tarea'
]
.
create
(
datos
)
if
vals
[
'accion'
]:
accion
=
vals
[
'accion'
]
acc
=
self
.
env
[
'hgt.acciones'
]
.
search
([(
'id'
,
'='
,
accion
)])
acc
.
tareas
=
[(
4
,
nueva_tar
.
id
)]
vals
[
'tarea'
]
=
nueva_tar
.
id
result
=
super
(
hgt_incidencias
,
self
)
.
create
(
vals
)
return
result
...
...
views/incidencias.xml
View file @
df0046d
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
<field
name=
"arch"
type=
"xml"
>
<field
name=
"arch"
type=
"xml"
>
<form>
<form>
<sheet>
<sheet>
<group
col=
"4"
string=
"
Datos de la
Incidencia"
>
<group
col=
"4"
string=
"Incidencia"
>
<field
colspan=
"2"
name=
"fecha_creacion"
/>
<field
colspan=
"2"
name=
"fecha_creacion"
/>
<field
colspan=
"2"
name=
"estado"
/>
<field
colspan=
"2"
name=
"estado"
/>
...
@@ -55,14 +55,10 @@
...
@@ -55,14 +55,10 @@
<field
name=
"reporte"
nolabel=
"1"
/>
<field
name=
"reporte"
nolabel=
"1"
/>
</page>
</page>
<page
string=
"Tarea"
>
<page
string=
"Tarea"
>
<group
col=
"
2
"
>
<group
col=
"
4
"
>
<field
name=
"proyecto"
colspan=
"2"
/>
<field
name=
"proyecto"
colspan=
"2"
/>
</group>
<group
col=
"2"
>
<field
name=
"accion"
colspan=
"2"
/>
<field
name=
"accion"
colspan=
"2"
/>
</group>
<field
name=
"tarea"
colspan=
"2"
readonly=
"1"
/>
<group
col=
"2"
>
<field
name=
"tarea"
colspan=
"2"
/>
</group>
</group>
</page>
</page>
</notebook>
</notebook>
...
...
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