Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Odoo error page stuck when use a function

Subscriure's

Get notified when there's activity on this post

This question has been flagged
functionerrorcreatestuckodoo9
4010 Vistes
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

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
Execute a function when you click Create button? Odoo 9 New API
function create api new odoo9
Avatar
0
d’oct. 22
3760
AttributeError: ondelete Odoo 9
error one2many create attributeerror odoo9
Avatar
0
de febr. 19
3992
Function to openERP python
function create
Avatar
Avatar
2
d’abr. 15
6017
after opening a backup i get this error and cant see all my data
error backup stuck
Avatar
0
de maig 24
1848
Error Findings
invoice error create
Avatar
0
de nov. 23
1931
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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