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 18e246ac
authored
2022-09-28 18:18:26 -0300
by
adrian
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Optimizacion en busca de puntos de retiro
1 parent
87684007
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
controllers/controllers.py
models/transportista.py
controllers/controllers.py
View file @
18e246a
...
...
@@ -29,7 +29,7 @@ class dispositivos(http.Controller):
registro
=
http
.
request
.
env
[
'asw.localidad'
]
.
sudo
()
palabra
=
argentinidad
.
arg
(
kw
[
"localidad"
])
dominio
=
[[
"buscador"
,
"ilike"
,
palabra
]]
localidades
=
registro
.
search
(
dominio
,
limit
=
10
)
localidades
=
registro
.
search
(
dominio
,
limit
=
10
)
#limite original 10
resultado
=
[]
for
localidad
in
localidades
:
loc
=
{
...
...
@@ -80,9 +80,12 @@ class dispositivos(http.Controller):
def
ArmarListaTrans
(
self
,
loc1
,
loc2
):
loc1
=
self
.
TransportistaLocalidad
(
loc1
)
loc2
=
self
.
TransportistaLocalidad
(
loc2
)
trans_ids
=
list
(
set
(
loc1
[
0
])
&
set
(
loc2
[
0
]))
origen
=
loc1
[
1
]
destino
=
loc2
[
1
]
if
(
len
(
loc1
)
==
0
)
or
(
len
(
loc2
)
==
0
)
:
print
(
"cero"
)
return
([],
origen
,
destino
)
trans_ids
=
list
(
set
(
loc1
[
0
])
&
set
(
loc2
[
0
]))
transportistas
=
http
.
request
.
env
[
'trans.transportista'
]
.
sudo
()
.
browse
(
trans_ids
)
lista1
=
[]
lista2
=
[]
...
...
@@ -107,10 +110,10 @@ class dispositivos(http.Controller):
dato
[
"categoria"
]
=
cat
[
transportista
.
trans_categoria
]
return
(
dato
)
def
TransportistaLocalidad
(
self
,
loc_id
):
puntos
=
http
.
request
.
env
[
'trans.punto_retiro'
]
.
sudo
()
.
search
([])
def
TransportistaLocalidad
(
self
,
loc_id
):
#corregida la funcion esta lambda ponia lento todo
puntos
=
http
.
request
.
env
[
'trans.punto_retiro'
]
.
sudo
()
.
search
([
[
"pr_localidad"
,
"="
,
loc_id
]
])
local
=
http
.
request
.
env
[
'asw.localidad'
]
.
sudo
()
.
search
([[
"id"
,
"="
,
loc_id
]])
puntos
=
puntos
.
filtered
(
lambda
l
:
l
.
pr_localidad
==
local
)
#
puntos = puntos.filtered(lambda l: l.pr_localidad == local)
resultado
=
[]
for
punto
in
puntos
:
try
:
...
...
models/transportista.py
View file @
18e246a
...
...
@@ -413,7 +413,7 @@ class trans_transportista(models.Model):
self
.
publicada_img
=
"sa"
def
url_logo_trans
(
self
):
print
(
"Inafsdf"
)
#
print("Inafsdf")
if
self
.
publicada_img
==
"a"
:
return
(
self
.
url_img_publica
)
else
:
...
...
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