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
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • e-learning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Inteligencia artificial
    • IoT
    • VoIP
    • Información
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Sectores
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Alimentación y hostelería
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidor de bebidas
    • Hotel
    Inmueble
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Asesoría contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textil
    • Metal
    • Muebles
    • Alimentos
    • Cervecería
    • Regalos corporativos
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Oficios
    • Servicios de mantenimiento
    • Hardware y soporte técnico
    • Sistemas de energía solar
    • Zapatero
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin ánimo de lucro
    • Agencia de protección del medio ambiente
    • Alquiler de vallas publicitarias
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Explorar todos los sectores
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Servicios para partners
    • Registrar tu asesoría contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Sobre este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Sobre este foro
Ayuda

Redirecting trough javascript with window action problem

Suscribirse

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

Esta pregunta ha sido marcada
javascriptnotificationxmlrpcwindow_actionodoo10
2 Respuestas
8075 Vistas
Avatar
Samo Arko

I'm trying to create a task with a button on a notification and then redirect to the created record. I'm doing this like the calendars event reminders. So I've extended the notification with a button and added the class. Extended the JS for notification with click event that when its clicked it calls a controller with the action ID. The controller creates the task, fills the res_id for the action and returns it and executes the action.

The problem is that sometimes it redirects and sometimes not and I don't know how to find the problem. When it doesn't redirect it creates the task but the javascript doesn't get the return. The return action has the exactly same data both times.

JS:

var TablaCallNotification = Notification.extend({
template: "TablaCallNotification",

init: function(parent, title, text, eid, show_details) {

this._super(parent, title, text, true, show_details);
this.show_details = show_details;
this.eid = eid;

this.events = _.extend(this.events || {}, {
'click .link2createtask': function() {
var self = this;
this.rpc("/calls/create/task", {
call_id: eid,
action_id: "tabla_asterisk_calls.action_show_call_ticket",
}).then(function(r) {
console.log('Create Task action: ' + r)
return self.do_action(r);
});
this.destroy(true);
},

'click .link2cancel': function() {
this.destroy(true);
},
});
},
});

Notification view

<template>
<t t-name="TablaCallNotification" t-extend="Notification">
<t t-jquery=".o_notification_title > t" t-operation="replace">
<span t-attf-class="link2event eid_{{widget.eid}}">
<t t-esc="widget.title"/>
</span>
</t>
<t t-jquery=".o_notification_content" t-operation="append">
<br/><br/>
<button type="button" class="btn btn-sm btn-primary link2createtask">Ustvari Opravilo</button>
<button type="button" class="btn btn-sm btn-link link2cancel">Cancel</button>
</t>
</t>
</template>

Action

<record id="action_show_call_ticket" model="ir.actions.act_window">
<field name="name">Show Call Ticket</field>
<field name="res_model">project.task</field>
<field name="view_mode">form</field>
<field name="view_id" ref="project.view_task_form2"/>
</record>

When it doesn't redirect to the created task the console.log doesn't get executed. 

I'm using a reverse proxy. The site configuration for SSL is on another server and that one redirects to the Odoo server. So on the Odoo server I get only request only on port 80. 

Odoo.conf

[options]
 

db_host = False
db_port = False
db_user = user
db_password = False
dbfilter = ^%h$

addons_path = /opt/odoo/odoo10/addons,/opt/odoo/customaddons
logfile = /var/log/odoo/odoo.log
log_handler = odoo.sql_db:ERROR
log_level = warn
log_db_level = warn
logrotate = True

longpolling_port = 8072
xmlrpc_port = 8069

proxy_mode = True

workers = 2
max_cron_threads = 1

limit_time_cpu = 600
limit_time_real = 1200

NxginX site conf

server {
listen 80;
server_name somedomain.si;

access_log /var/log/nginx/moj.access.log;
error_log /var/log/nginx/moj.error.log;

proxy_buffers 16 64k;
proxy_buffer_size 128k;

client_max_body_size 24000M;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;

# Proxy Headers
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;

location / {
proxy_pass http://odoo;
}

location /longpolling {
proxy_read_timeout 300s;
proxy_connect_timeout 75s;
proxy_pass http://odoo-lp;
}
}

NginX conf

user www-data;
worker_processes auto;
pid /run/nginx.pid;

events {
worker_connections 768;
}

http {
proxy_connect_timeout 900;
proxy_send_timeout 900;
proxy_read_timeout 900;
send_timeout 900;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;

include /etc/nginx/mime.types;
default_type application/octet-stream;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

gzip on;
gzip_disable "msie6";

upstream odoo {
server 127.0.0.1:8069 weight=1 fail_timeout=3000s;
}
upstream odoo-lp {
server 127.0.0.1:8072;
}

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

Can someone help me with this problem? Does anyone know what can cause it? I'm really out of ideas. 





 

0
Avatar
Descartar
Avatar
Ravi Gadhia
Mejor respuesta

I think it's due to this.destroy(true) in link2createtask.  create task async call take time to complete and before that widget is destroyed no action performs. sometimes it redirects due to async call resolved before destroy 

1
Avatar
Descartar
Samo Arko
Autor

Thanks for the answer... the first tests look promising.

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

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

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
How to remove (x) button in window action?
window_action odoo10
Avatar
0
jun 21
4299
XMLRPC create picklist in odoo 10 API Resuelto
xmlrpc odoo10
Avatar
3
ago 17
7528
openerp where to set response.header
javascript xmlrpc
Avatar
0
mar 16
6567
how to call javascript function on button with xml in odoo? Resuelto
javascript xml odoo10
Avatar
Avatar
2
jun 23
44852
How to replace/update the values on message_ids field in odoo 10.
xmlrpc python2.7 odoo10
Avatar
0
may 23
4053
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información 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 Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo es un conjunto de aplicaciones empresariales de código abierto que cubre 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