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 eaa7e7b3
authored
2022-07-19 10:39:04 -0300
by
Juan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Mejoras salidas de la reunion del lunes
1 parent
71fc46db
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
95 additions
and
0 deletions
controllers/__init__.py
controllers/check.py
models/__init__.py
models/transportista.py
models/user.py
controllers/__init__.py
View file @
eaa7e7b
...
@@ -2,3 +2,4 @@
...
@@ -2,3 +2,4 @@
from
.
import
controllers
from
.
import
controllers
from
.
import
altausuario
from
.
import
altausuario
from
.
import
check
\ No newline at end of file
\ No newline at end of file
controllers/check.py
0 → 100644
View file @
eaa7e7b
# -*- coding: utf-8 -*-
from
odoo
import
http
from
datetime
import
datetime
,
timedelta
import
json
,
random
,
string
#(datetime.now() - timedelta(hours=3)).strftime('%Y-%m-%d %H:%M')
class
hgt_login
(
http
.
Controller
):
"""Controlador para chequear usuario contraseña y eso"""
@http.route
(
'/app/login_check_pass'
,
auth
=
'public'
,
type
=
'json'
,
website
=
False
,
csrf
=
False
,
methods
=
[
'POST'
,
'GET'
])
def
index
(
self
,
**
kw
):
user
=
kw
.
get
(
'user'
)
passw
=
kw
.
get
(
'pass'
)
user
=
self
.
login
(
user
,
passw
)
rta
=
{
"login"
:
user
[
0
],
"id"
:
user
[
1
]}
return
(
rta
)
def
login
(
self
,
User
,
Pass
):
user
=
http
.
request
.
env
[
'res.users'
]
.
sudo
()
.
search
([[
"login"
,
"="
,
User
]])
try
:
user_id
=
user
.
id
user
.
sudo
(
user_id
)
.
check_credentials
(
Pass
)
#user.sudo(user_id)._update_last_login()
return
(
True
,
user_id
)
except
:
return
(
False
,
0
)
\ No newline at end of file
\ No newline at end of file
models/__init__.py
View file @
eaa7e7b
...
@@ -8,3 +8,4 @@ from . import solicitudes
...
@@ -8,3 +8,4 @@ from . import solicitudes
from
.
import
mensajes
from
.
import
mensajes
from
.
import
no_transporta
from
.
import
no_transporta
from
.
import
comprobante
from
.
import
comprobante
from
.
import
user
\ No newline at end of file
\ No newline at end of file
models/transportista.py
View file @
eaa7e7b
...
@@ -65,6 +65,16 @@ class trans_transportista(models.Model):
...
@@ -65,6 +65,16 @@ class trans_transportista(models.Model):
string
=
u'Elementos que no transporta'
,
string
=
u'Elementos que no transporta'
,
help
=
'Aclarar aquí qué elementos no transporta, si los hubiera'
,
help
=
'Aclarar aquí qué elementos no transporta, si los hubiera'
,
)
)
#trans_domicilio
trans_domicilio
=
fields
.
Char
(
string
=
'Domicilio fiscal'
)
#condicion_iva
condicion_iva
=
fields
.
Char
(
string
=
'Condicio de iva'
)
#probincia char
probincia
=
fields
.
Char
(
string
=
'Provincia ingreso brutos'
)
#constancia_afip_contenido
constancia_afip_contenido
=
fields
.
Binary
(
string
=
'Constancia afip'
)
#constancia_afip_nombre
constancia_afip_nombre
=
fields
.
Char
(
string
=
'Constancia afip'
)
trans_tipo
=
fields
.
Many2many
(
trans_tipo
=
fields
.
Many2many
(
string
=
u'Tipo de Transporte'
,
string
=
u'Tipo de Transporte'
,
...
@@ -422,3 +432,12 @@ class trans_transportista(models.Model):
...
@@ -422,3 +432,12 @@ class trans_transportista(models.Model):
def
Confirmacion
(
self
):
def
Confirmacion
(
self
):
self
.
trans_categoria
=
"p"
self
.
trans_categoria
=
"p"
def
AgregarPuntoRetiroWEB
(
self
,
vals
):
print
(
self
)
Ids
=
self
.
trans_pto_retiro
.
ids
punto
=
self
.
env
[
'trans.punto_retiro'
]
.
create
(
vals
)
Ids
.
append
(
punto
.
id
)
self
.
trans_pto_retiro
=
Ids
\ No newline at end of file
\ No newline at end of file
models/user.py
0 → 100644
View file @
eaa7e7b
from
odoo
import
models
,
fields
,
api
,
exceptions
from
odoo.exceptions
import
UserError
,
ValidationError
,
Warning
,
RedirectWarning
import
base64
,
json
,
requests
from
passlib.context
import
CryptContext
class
res_users
(
models
.
Model
):
_inherit
=
'res.users'
_order
=
'id desc'
def
CambiarContrasenia
(
self
,
val
):
print
(
self
.
id
,
self
.
env
.
user
.
id
)
#Validar pass minimo
#may min numero minimo 8 caracteres
if
self
.
id
!=
self
.
env
.
user
.
id
:
return
(
"No se puede cambiar contraseña agena"
)
print
(
val
)
headers
=
{
'Content-Type'
:
'application/json'
}
data
=
{
'params'
:{
'user'
:
self
.
login
,
'pass'
:
val
[
"pass_actual"
]}}
data_json
=
json
.
dumps
(
data
)
r
=
requests
.
post
(
'http://127.0.0.1:8001/app/login_check_pass'
,
data
=
data_json
,
headers
=
headers
)
respuesta
=
r
.
json
()
user
=
respuesta
[
"result"
]
print
(
user
)
if
not
user
[
"login"
]:
return
(
"Contraseña no coincide cancelando proceso"
)
return
(
f
"""Seteando contraseña nueva {val["pass_nueva"]}/No habilitado"""
)
def
CambiarMail
(
self
,
val
):
print
(
self
.
id
,
self
.
env
.
user
.
id
)
#Validar pass minimo
#may min numero minimo 8 caracteres
if
self
.
id
!=
self
.
env
.
user
.
id
:
return
(
"No se puede cambiar mail ajeno"
)
print
(
val
)
headers
=
{
'Content-Type'
:
'application/json'
}
data
=
{
'params'
:{
'user'
:
self
.
login
,
'pass'
:
val
[
"pass_actual"
]}}
print
(
data
)
data_json
=
json
.
dumps
(
data
)
r
=
requests
.
post
(
'http://127.0.0.1:8001/app/login_check_pass'
,
data
=
data_json
,
headers
=
headers
)
respuesta
=
r
.
json
()
user
=
respuesta
[
"result"
]
print
(
user
)
if
not
user
[
"login"
]:
return
(
"Contraseña no coincide cancelando proceso"
)
return
(
f
"""Seteando mail nuevo {val["user_nuevo"]}/No habilitado"""
)
\ No newline at end of file
\ No newline at end of file
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