
from odoo import http


class BasePhoneController(http.Controller):
    @http.route('/base_phone/click2dial', type='json', auth='none')
    def click2dial(self, phone_number, click2dial_model, click2dial_id):
        res = http.request.env['phone.common'].click2dial(
            phone_number, {
                'click2dial_model': click2dial_model,
                'click2dial_id': click2dial_id,
            })
        return res


from odoo import http


class BasePhoneController(http.Controller):
    @http.route('/base_phone/click2dial', type='json', auth='user')
    def click2dial(self, phone_number, click2dial_model, click2dial_id):
        res = http.request.env['phone.common'].with_context(
            click2dial_model=click2dial_model,
            click2dial_id=click2dial_id).click2dial(phone_number)
        return res

Make click2dial work in real life
Make click2dial work in real life

  
  from odoo import http
  
  
  class BasePhoneController(http.Controller):
-     @http.route('/base_phone/click2dial', type='json', auth='none')
+     @http.route('/base_phone/click2dial', type='json', auth='user')
      def click2dial(self, phone_number, click2dial_model, click2dial_id):
-         res = http.request.env['phone.common'].click2dial(
+         res = http.request.env['phone.common'].with_context(
-             phone_number, {
-                 'click2dial_model': click2dial_model,
+             click2dial_model=click2dial_model,
+             click2dial_id=click2dial_id).click2dial(phone_number)
-                 'click2dial_id': click2dial_id,
-             })
          return res
  
Make click2dial work in real life
## Code Before:

from odoo import http


class BasePhoneController(http.Controller):
    @http.route('/base_phone/click2dial', type='json', auth='none')
    def click2dial(self, phone_number, click2dial_model, click2dial_id):
        res = http.request.env['phone.common'].click2dial(
            phone_number, {
                'click2dial_model': click2dial_model,
                'click2dial_id': click2dial_id,
            })
        return res

## Instruction:
Make click2dial work in real life
## Code After:

from odoo import http


class BasePhoneController(http.Controller):
    @http.route('/base_phone/click2dial', type='json', auth='user')
    def click2dial(self, phone_number, click2dial_model, click2dial_id):
        res = http.request.env['phone.common'].with_context(
            click2dial_model=click2dial_model,
            click2dial_id=click2dial_id).click2dial(phone_number)
        return res
