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.