You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109 lines
4.5 KiB

  1. # Copyright (C) 2019 Open Source Integrators
  2. # <https://www.opensourceintegrators.com>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from odoo import fields, models
  5. VOICENT_CONTACT_COLUMNS = [('Assigned To', 'Assigned To'),
  6. ('Business', 'Business'),
  7. ('Category', 'Category'),
  8. ('Contact Status', 'Contact Status'),
  9. ('Email', 'Email'),
  10. ('First Name', 'First Name (Required)'),
  11. ('Last Name', 'Last Name'),
  12. ('Lead Source', 'Lead Source'),
  13. ('Other', 'Other'),
  14. ('Phone', 'Phone (Required)')]
  15. VOICENT_REPLY = [('availableagents', 'Available Agents'),
  16. ('callback', 'Callback'),
  17. ('campid', 'Campaign ID'),
  18. ('campname', 'Campaign Name'),
  19. ('campsize', 'Campaign Size'),
  20. ('connected', 'Connected'),
  21. ('dnc', 'Contact DNC'),
  22. ('nophone', 'Contact No Phone'),
  23. ('disc', 'Disc. Number'),
  24. ('dropped', 'Dropped'),
  25. ('failed', 'Failed'),
  26. ('fax', 'Fax'),
  27. ('info', 'Info'),
  28. ('in', 'Interested'),
  29. ('lines', 'Lines'),
  30. ('linebusy', 'Line Busy'),
  31. ('live', 'Live Answer'),
  32. ('machine', 'Machine Answer'),
  33. ('made', 'Made'),
  34. ('maxlines', 'Max Lines'),
  35. ('noact', 'No Activity'),
  36. ('noanswer', 'No Answer'),
  37. ('notin', 'Not Interested'),
  38. ('notes', 'Notes'),
  39. ('optout', 'Opt Out'),
  40. ('serverr', 'Service Error'),
  41. ('status', 'Status'),
  42. ('totalagents', 'Total Agents'),
  43. ('wit', 'Wit')]
  44. MSGTYPE = [('audio', 'Audio'),
  45. ('ivr', 'IVR'),
  46. ('survey', 'Survey'),
  47. ('template', 'Template'),
  48. ('tts', 'Text-To-Speech')]
  49. class BackendVoicentCallLine(models.Model):
  50. _name = 'backend.voicent.call.line'
  51. _description = 'Voicent Backend Call Line'
  52. name = fields.Char(string='Name', required=True)
  53. sequence = fields.Integer(string='Sequence', default=0)
  54. applies_on = fields.Selection(string='Applies on', selection=[])
  55. msgtype = fields.Selection(MSGTYPE, string='Message Type', required=True)
  56. msginfo = fields.Char(string='Message Info')
  57. backend_id = fields.Many2one(
  58. string='Backend',
  59. comodel_name='backend.voicent',
  60. ondelete='set null')
  61. reply_ids = fields.One2many('backend.voicent.call.line.reply', 'line_id',
  62. string="Replies")
  63. contact_ids = fields.One2many('backend.voicent.call.line.contact',
  64. 'line_id',
  65. string="Contact Info")
  66. class BackendVoicentCallLineContact(models.Model):
  67. _name = 'backend.voicent.call.line.contact'
  68. _description = 'Columns of the CSV file to provide the contact list'
  69. _order = 'sequence'
  70. name = fields.Selection(VOICENT_CONTACT_COLUMNS, string='Voicent Field',
  71. required=True)
  72. other = fields.Char(string='Other')
  73. sequence = fields.Integer(string='Sequence', default=0)
  74. field_domain = fields.Char(string='Odoo Field',
  75. required=True)
  76. default_value = fields.Char(string='Default Value', required=True)
  77. line_id = fields.Many2one(
  78. string='Call Line',
  79. comodel_name='backend.voicent.call.line',
  80. ondelete='set null')
  81. class BackendVoicentCallLineReply(models.Model):
  82. _name = 'backend.voicent.call.line.reply'
  83. _description = 'Reply to a Voicent Call'
  84. name = fields.Char(string='Name', required=True)
  85. line_id = fields.Many2one(
  86. string='Call Line',
  87. comodel_name='backend.voicent.call.line',
  88. ondelete='set null')
  89. reply_field = fields.Selection(VOICENT_REPLY, string="Voicent Reply Field",
  90. required=True)
  91. reply_value = fields.Char(string="Voicent Reply Value", required=True)
  92. action_id = fields.Many2one('ir.actions.server', string="Server Action",
  93. required=True,
  94. help="""If the Voicent reply field is equal to
  95. the Voicent reply value, the server action is
  96. executed.""")