Browse Source

Fix bug #93... but it seems do_notify() is not working in v9 in this branch

pull/88/head
Alexis de Lattre 8 years ago
parent
commit
04993ae3f8
  1. 15
      asterisk_click2dial/static/src/js/asterisk_click2dial.js
  2. 6
      base_phone/static/src/js/phone_widget.js

15
asterisk_click2dial/static/src/js/asterisk_click2dial.js

@ -29,10 +29,18 @@ click2dial.OpenCaller = Widget.extend({
self.rpc('/asterisk_click2dial/get_record_from_my_channel', {}).done(function(r) {
// console.log('RESULT RPC r='+r);
// console.log('RESULT RPC type r='+typeof r);
// console.log('RESULT RPC isNaN r='+isNaN(r));
if (r === false) {
self.do_notify(
self.do_warn(
_t('Failure'),
_t('Problem in the connection to Asterisk'));
_t('Problem in the connection to Asterisk'),
false);
}
else if (typeof r == 'string' && isNaN(r)) {
self.do_warn(
r,
_t('The calling number is not a phone number!'),
false);
}
else if (typeof r == 'string') {
var action = {
@ -50,7 +58,8 @@ click2dial.OpenCaller = Widget.extend({
else if (typeof r == 'object' && r.length == 3) {
self.do_notify( // Not working
_t('Success'),
_t('Moving to %s ID %d', r[0], r[1]));
_t('Moving to %s ID %d', r[0], r[1]),
false);
var action = {
type: 'ir.actions.act_window',
res_model: r[0],

6
base_phone/static/src/js/phone_widget.js

@ -45,7 +45,8 @@ var FieldPhone = formwidgets.FieldChar.extend({
.on('click', function(ev) {
self.do_notify(
_t('Click2dial started'),
_t('Unhook your ringing phone'));
_t('Unhook your ringing phone'),
false);
var arg = {
'phone_number': raw_phone_num,
'click2dial_model': self.view.dataset.model,
@ -57,7 +58,8 @@ var FieldPhone = formwidgets.FieldChar.extend({
} else if (typeof r === 'object') {
self.do_notify(
_t('Click2dial successfull'),
_t('Number dialed:') + ' ' + r.dialed_number);
_t('Number dialed:') + ' ' + r.dialed_number,
false);
if (r.action_model) {
var context = {
'click2dial_model': self.view.dataset.model,

Loading…
Cancel
Save