OCA / connector-telephony

Odoo modules for telephony integration
GNU Affero General Public License v3.0
151 stars 293 forks source link

[12] base_phone (via asterisk_click2dial) : web client jumps to the default tab after any (un)successful call #214

Closed luffah closed 1 year ago

luffah commented 4 years ago

Hello,

Module(s) : asterisk_click2dial (, base_phone) Version : 12.0.1.0.0 (https://github.com/OCA/connector-telephony/commit/6d9df1037a97dbf791a7f0a717846a63144174bb)

when i use asterisk_click2dial (dial button) on a contact sheet (model=res.partner&view_type=form), the Odoo web client acts like it was jumping to the first item in the main menu list (default tab). (Is it crash that cause this behavior ? i see exeptions in javascript console)

I got this issue in 2 cases :

Step to reproduce

What seems to be a normal behavior

luffah commented 4 years ago

I tried to remove module _asteriskclick2dial and forcing true to show dial button. When i click on it, it tries a dummy call and have the effect described in the issue.

luffah commented 4 years ago

I didn't find in Odoo12 doc how to preserve location, therefore (as a workaround) i could use some dirty javascript tricks in base_phone js part :

        click2dial: function(phone_num) {
            .
            .
            var orig_location = window.location.href;
            .
            .
            .
            window.location.href = orig_location;
            // window.location.reload(true); 
            .
            .
            .

See commit https://github.com/osiell/connector-telephony/commit/a2cb8d698e440473529516cba8df45d736138f16

filipocc commented 4 years ago

I didn't find in Odoo12 doc how to preserve location, therefore (as a workaround) i could use some dirty javascript tricks in base_phone js part :

        click2dial: function(phone_num) {
            .
            .
            var orig_location = window.location.href;
            .
            .
            .
            window.location.href = orig_location;
            // window.location.reload(true); 
            .
            .
            .

See commit osiell@a2cb8d6

Hi @luffah , did you find any other solution? We are facing the same issue after clicking "click2dial" button, and our workaround looks like this, in phone_widget.js:

            var phone_num = this.value;
            dial.click(function(evt) {
                self.click2dial(phone_num);
                window.open(evt.target.baseURI);
            });

Our solution is almost the same as yours, but we are navigating to the current form (res.partner, crm.lead...) in a new tab. But looks not good enough for our customer. Are you still working on this? We don't really know how to solve this. Thanks in advance!

luffah commented 4 years ago

The solution described was good enough for us. Personnally, I avoid to open new tabs because i had too often encountered surprise logout issues with Odoo when multiples tabs are openned.

filipocc commented 4 years ago

The solution described was good enough for us. Personnally, I avoid to open new tabs because i had too often encountered surprise logout issues with Odoo when multiples tabs are openned.

Ok, thanks @luffah ! I’m still working on this issue... It seems to be a bug in Odoo 12 because, as far as I could see, the module is completely the same in Odoo 10 and 11. I tried in both versions and the telephony module works properly.

github-actions[bot] commented 2 years ago

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

Cristian-Rguez commented 2 years ago

Hi, I think a better solution that worked for me would be

dial.click(function(evt) {
    evt.preventDefault();
    self.click2dial(phone_num);
});

This prevents the page from reloading to the same url. Tested in Firefox and Chrome

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.