Pular para o conteúdo
Odoo Menu
  • Entrar
  • Experimente grátis
  • Aplicativos
    Finanças
    • Financeiro
    • Faturamento
    • Despesas
    • Planilhas (BI)
    • Documentos
    • Assinar Documentos
    Vendas
    • CRM
    • Vendas
    • PDV Loja
    • PDV Restaurantes
    • Assinaturas
    • Locação
    Websites
    • Criador de Sites
    • e-Commerce
    • Blog
    • Fórum
    • Chat ao Vivo
    • e-Learning
    Cadeia de mantimentos
    • Inventário
    • Fabricação
    • PLM - Ciclo de Vida do Produto
    • Compras
    • Manutenção
    • Qualidade
    Recursos Humanos
    • Funcionários
    • Recrutamento
    • Folgas
    • Avaliações
    • Indicações
    • Frota
    Marketing
    • Redes Sociais
    • Marketing por E-mail
    • Marketing por SMS
    • Eventos
    • Automação de Marketing
    • Pesquisas
    Serviços
    • Projeto
    • Planilhas de Horas
    • Serviço de Campo
    • Central de Ajuda
    • Planejamento
    • Compromissos
    Produtividade
    • Mensagens
    • Inteligência Artificial
    • Internet das Coisas
    • VoIP
    • Conhecimento
    • WhatsApp
    Aplicativos de terceiros Odoo Studio Plataforma Odoo Cloud
  • Setores
    Varejo
    • Loja de livros
    • Loja de roupas
    • Loja de móveis
    • Mercearia
    • Loja de ferramentas
    • Loja de brinquedos
    Comida e hospitalidade
    • Bar e Pub
    • Restaurante
    • Fast Food
    • Hospedagem
    • Distribuidor de bebidas
    • Hotel
    Imóveis
    • Imobiliária
    • Escritório de arquitetura
    • Construção
    • Gestão de Imóveis
    • Jardinagem
    • Associação de proprietários de imóveis
    Consultoria
    • Escritório de Contabilidade
    • Parceiro Odoo
    • Agência de marketing
    • Escritório de advocacia
    • Aquisição de talentos
    • Auditoria e Certificação
    Fabricação
    • Têxtil
    • Metal
    • Móveis
    • Alimentação
    • Cervejaria
    • Presentes corporativos
    Saúde e Boa forma
    • Clube esportivo
    • Loja de óculos
    • Academia
    • Profissionais de bem-estar
    • Farmácia
    • Salão de cabeleireiro
    Comércio
    • Handyman
    • Hardware e Suporte de TI
    • Sistemas de energia solar
    • Sapataria
    • Serviços de limpeza
    • Serviços de climatização
    Outros
    • Organização sem fins lucrativos
    • Agência Ambiental
    • Aluguel de outdoors
    • Fotografia
    • Aluguel de bicicletas
    • Revendedor de software
    Navegar por todos os setoresInauguration Odoo Lyon
  • Comunidade
    Aprenda
    • Tutoriais
    • Documentação
    • Certificações
    • Treinamento
    • Blog
    • Podcast
    Empodere a Educação
    • Programa de educação
    • Scale Up! Jogo de Negócios
    • Visite a Odoo
    Obtenha o Software
    • Baixar
    • Comparar edições
    • Releases
    Colaborar
    • Github
    • Fórum
    • Eventos
    • Traduções
    • Torne-se um parceiro
    • Serviços para parceiros
    • Cadastre seu escritório contábil
    Obtenha os serviços
    • Encontre um parceiro
    • Encontre um Contador
    • Agende uma Demonstração
    • Serviços de Implementação
    • Referências de Clientes
    • Suporte
    • Upgrades
    Github YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Faça uma demonstração
  • Preços
  • Ajuda
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
É necessário estar registrado para interagir com a comunidade.
Todas as publicações Pessoas Emblemas
Marcadores (Ver tudo)
odoo accounting v14 pos v15
Sobre este fórum
Ajuda

Redirecting trough javascript with window action problem

Inscrever

Seja notificado quando houver atividade nesta publicação

Esta pergunta foi sinalizada
javascriptnotificationxmlrpcwindow_actionodoo10
2 Respostas
8068 Visualizações
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
Cancelar
Avatar
Ravi Gadhia
Melhor resposta

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
Cancelar
Samo Arko
Autor

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

Está gostando da discussão? Não fique apenas lendo, participe!

Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!

Inscrever-se
Publicações relacionadas Respostas Visualizações Atividade
How to remove (x) button in window action?
window_action odoo10
Avatar
0
jun. 21
4299
XMLRPC create picklist in odoo 10 API Resolvido
xmlrpc odoo10
Avatar
3
ago. 17
7527
openerp where to set response.header
javascript xmlrpc
Avatar
0
mar. 16
6567
how to call javascript function on button with xml in odoo? Resolvido
javascript xml odoo10
Avatar
Avatar
2
jun. 23
44848
How to replace/update the values on message_ids field in odoo 10.
xmlrpc python2.7 odoo10
Avatar
0
mai. 23
4053
Comunidade
  • Tutoriais
  • Documentação
  • Fórum
Open Source
  • Baixar
  • Github
  • Runbot
  • Traduções
Serviços
  • Odoo.sh Hosting
  • Suporte
  • Upgrade
  • Desenvolvimentos personalizados
  • Educação
  • Encontre um Contador
  • Encontre um parceiro
  • Torne-se um parceiro
Sobre nós
  • Nossa empresa
  • Ativos da marca
  • Contato
  • Empregos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidade
  • Segurança
الْعَرَبيّة 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 é um conjunto de aplicativos de negócios em código aberto que cobre todas as necessidades de sua empresa: CRM, comércio eletrônico, contabilidade, estoque, ponto de venda, gerenciamento de projetos, etc.

A proposta de valor exclusiva Odoo é ser, ao mesmo tempo, muito fácil de usar e totalmente integrado.

Site feito com

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