Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Maria Agustina
/
hgt_transportar
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 8d7be85a
authored
2021-05-10 20:28:39 -0300
by
Juan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
oio
1 parent
2fbdecf6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
32 deletions
models/punto_retiro.py
models/transportista.py
models/punto_retiro.py
View file @
8d7be85
...
...
@@ -34,7 +34,7 @@ class trans_punto_retiro(models.Model):
help
=
u'Ingrese información sobre horarios en feriados locales'
,
)
pr_telefono
=
fields
.
Intege
r
(
pr_telefono
=
fields
.
Cha
r
(
string
=
'Número de Teléfono'
,
required
=
True
)
...
...
models/transportista.py
View file @
8d7be85
...
...
@@ -6,16 +6,13 @@ class trans_transportista(models.Model):
_description
=
'Transportista'
_rec_name
=
'trans_nombre'
_order
=
'trans_nombre'
_sql_constraints
=
[
(
'trans_cuit_unique'
,
'UNIQUE(trans_cuit)'
,
'Ya existe otro transportista con el mismo CUIT, por favor revíselo y vuelva a intentarlo'
),
]
trans_razon_social
=
fields
.
Char
(
string
=
u'Razón Social'
,
)
trans_cuit
=
fields
.
Intege
r
(
trans_cuit
=
fields
.
Cha
r
(
string
=
u'CUIT'
)
trans_pagina_web
=
fields
.
Char
(
...
...
@@ -40,7 +37,7 @@ class trans_transportista(models.Model):
default
=
"np"
)
trans_telefono
=
fields
.
Intege
r
(
trans_telefono
=
fields
.
Cha
r
(
string
=
u'Teléfono'
,
)
...
...
@@ -105,34 +102,56 @@ class trans_transportista(models.Model):
"""Funcion para el robot, revisar si esta localidad y provincia y si no crearla
agregar transportista si no existe, agregar localidad-provincia al transportista"""
#print(vals)
try
:
localidad
=
vals
[
"localidad"
]
provincia
=
vals
[
"provincia"
]
transportista
=
vals
[
"transportista"
]
except
:
return
(
"nop"
)
#print(localidad,provincia,transportista)
Localidad
=
self
.
env
[
"asw.localidad"
]
.
search
([[
"descripcion"
,
"=ilike"
,
localidad
],[
"loc_provincia"
,
"=ilike"
,
provincia
]],
limit
=
1
)
self
.
transportista_punto
(
transportista
,
Localidad
)
self
.
transportista_punto
(
transportista
,
Localidad
,
vals
)
return
(
vals
)
def
transportista_punto
(
self
,
transportista
,
localidad
):
def
transportista_punto
(
self
,
transportista
,
localidad
,
vals
):
trans
=
self
.
search
([[
'trans_nombre'
,
'=ilike'
,
transportista
]])
if
len
(
trans
)
==
0
:
try
:
total
=
self
.
search_count
([])
vals
=
{
'trans_nombre'
:
transportista
}
vals
[
"trans_cuit"
]
=
total
vals
[
"trans_telefono"
]
=
total
vals
[
"trans_razon_social"
]
=
transportista
if
vals
[
"trans_cuit"
]
==
0
:
vals
[
"trans_cuit"
]
=
""
vals
[
"trans_cuit"
]
=
str
(
vals
[
"trans_cuit"
])
except
:
vals
[
"trans_cuit"
]
=
""
#vals["trans_cuit"] = total
#vals["trans_telefono"] = total
#vals["trans_razon_social"] = transportista
del
vals
[
"localidad"
]
del
vals
[
"transportista"
]
del
vals
[
"provincia"
]
vals
[
"trans_tipo_ent"
]
=
"emp"
try
:
if
vals
[
'trans_nombre'
]
==
False
or
vals
[
'trans_nombre'
]
==
""
:
vals
[
'trans_nombre'
]
=
transportista
except
:
vals
[
'trans_nombre'
]
=
transportista
trans
=
self
.
create
(
vals
)
elif
len
(
trans
)
==
1
:
trans
.
write
(
vals
)
#print("vals 142", vals)
self
.
punto
(
trans
,
localidad
)
#print(trans)
def
punto
(
self
,
transportista
,
localidad
):
print
(
transportista
,
localidad
)
#
print(transportista,localidad)
for
punto
in
transportista
.
trans_pto_retiro
:
try
:
if
punto
.
pr_localiad
.
id
==
localiad
.
id
:
return
()
except
:
pass
lista
=
transportista
.
trans_pto_retiro
.
ids
vals
=
{
"pr_direccion"
:
"-----------"
}
vals
[
"pr_localidad"
]
=
localidad
.
id
...
...
@@ -151,21 +170,3 @@ class trans_transportista(models.Model):
lista
.
append
(
transportista
.
trans_nombre
)
return
({
"transportistas"
:
lista
})
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