OCA/connector-telephony

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

Closed this issue · 8 comments

Hello,

Module(s) : asterisk_click2dial (, base_phone)
Version : 12.0.1.0.0 (6d9df10)

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 :

  • either the Asterisk server is well configured and the call is done
  • or the Asterisk server is not configured successfully and the call fails
    In both case, i use the functionality from a contact sheet, and after the call it goes back to the default tab.

Step to reproduce

  • (install module)
  • Set up your asterisk config in Odoo.
  • Set up a contact with a phone number.
  • Search contact in contact list.
  • Go to the contact form.
  • Click on ☎ Dial button.
  • Close the popup (if needed) after call ends (or fails).

What seems to be a normal behavior

  • after clicked on Dial button the current view on the contact shall stay in background; when the call is ended it goes back to the contact form (origin of the call)

I tried to remove module asterisk_click2dial 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.

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

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!

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.

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.

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.

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

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.