Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita una demostración
  • Precios
  • Ayuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyectos
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

Odoo error page stuck when use a function

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
functionerrorcreatestuckodoo9
4021 Vistas
Avatar
Jorge

Hello everybody, I'm having a problem with a function in Odoo, in my module You reserve a specifics rooms in a many2many (with checkbox widget) field, and a begin/end date in a one2many field (this one2many is for an auxiliar table that store only dates and the rooms), my function checks if you reserve the same room in the same date inside that another record in the database table and throw a error.

This is my function:


@api.model

def create(self, values):

flag = False

solicitudes = self.env['hr.infraestructuras.fech'].search([]) #The module table where I search the existed records

fmt = '%Y-%m-%d'

aux = datetime.datetime.strptime(values['x_fecha_inicio'], fmt) #Begin date that you choose

aux2 = datetime.datetime.strptime(values['x_fecha_fin'], fmt) #End date that you choose

for soli in solicitudes:

d1 = datetime.datetime.strptime(soli.x_fecha_inicio, fmt) #Begin date of each record of the table

d2 = datetime.datetime.strptime(soli.x_fecha_fin, fmt) #End date of each record of the table

dates_btwn = d1

self.env.cr.execute(

""" SELECT

hr_infraestructuras_instalaciones_id AS insta

FROM

hr_infraestructuras_fech_hr_infraestructuras_instalaciones_rel relacion

WHERE

hr_infraestructuras_fech_id = %s """, (soli.id,))

result = self.env.cr.dictfetchall()

while dates_btwn <= d2:

if aux == dates_btwn or aux2 == dates_btwn:

for instalacion_seleccionada in self.x_instalaciones_usadas:

for r in result:

if r == instalacion_seleccionada.id:

flag = True

cadena = str(dates_btwn)

raise UserError("El día "+cadena+" ya se han reservado las siguientes salas")

else:

dates_btwn = dates_btwn + relativedelta(days=1)

if flag == False:

return super(Hrinfraestructuras_fech, self).create(values)




This function searchs the rooms that are used by a record in a range of dates, but when I create the record my odoo is stuck like charging the page and I don't know what i'm doing bad

Could someone help me? Thanks!

0
Avatar
Descartar
Fatih Piristine

it is not odoo, it is your code.. whats the error log?

Jorge
Autor

In my log there isn't a error about this, but the page is stuck charging like 30 minutes and nothing happens

¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
Execute a function when you click Create button? Odoo 9 New API
function create api new odoo9
Avatar
0
oct 22
3760
AttributeError: ondelete Odoo 9
error one2many create attributeerror odoo9
Avatar
0
feb 19
4000
Function to openERP python
function create
Avatar
Avatar
2
abr 15
6022
after opening a backup i get this error and cant see all my data
error backup stuck
Avatar
0
may 24
1853
Error Findings
invoice error create
Avatar
0
nov 23
1933
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidad
  • Seguridad
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now