Commit eaa7e7b3 by Juan

Mejoras salidas de la reunion del lunes

1 parent 71fc46db
...@@ -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
# -*- 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
...@@ -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
...@@ -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
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
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!