Browse Source

Fix several bugs.

Refactor and cleanup code.
pull/101/head
Trever L. Adams 9 years ago
parent
commit
787ae637af
  1. 2
      crm_voip_logcall/README.rst
  2. 13
      logcall/models/crm_phonecall.py
  3. 25
      logcall/views/crm_phonecall_view.xml

2
crm_voip_logcall/README.rst

@ -1,4 +1,4 @@
CRM VoIP Phone Log-call CRM VoIP Phone Log-call
======================= =======================
This bridge pulls in a configuration ption for use by logcall. This enables linking to call recordings in the logcall functionality.
This bridge pulls in a configuration option for use by logcall. This enables linking to call recordings in the logcall functionality.

13
logcall/models/crm_phonecall.py

@ -32,9 +32,6 @@ logger = logging.getLogger(__name__)
class ResUsers(models.Model): class ResUsers(models.Model):
_inherit = 'res.users' _inherit = 'res.users'
end_date = fields.Datetime(
string='End Date', track_visibility='onchange', copy=False,
default=lambda self: fields.Datetime.now())
context_auto_log_calls = fields.Boolean( context_auto_log_calls = fields.Boolean(
string='Automatically Log Incoming Calls', default=True) string='Automatically Log Incoming Calls', default=True)
@ -42,6 +39,9 @@ class ResUsers(models.Model):
class CrmPhonecall(models.Model): class CrmPhonecall(models.Model):
_inherit = "crm.phonecall" _inherit = "crm.phonecall"
end_date = fields.Datetime(
string='End Date', track_visibility='onchange', copy=False,
default=lambda self: fields.Datetime.now())
recording_id = fields.Many2one('ir.attachment', string='Call Recording', recording_id = fields.Many2one('ir.attachment', string='Call Recording',
readonly=True) readonly=True)
@ -146,8 +146,11 @@ class PhoneCommon(models.AbstractModel):
odoo_start = \ odoo_start = \
phonecalls[0]['date'].strptime('%Y-%m-%d %H:%M:%S') phonecalls[0]['date'].strptime('%Y-%m-%d %H:%M:%S')
if phonecalls[0]['description']: if phonecalls[0]['description']:
odoo_description = phonecalls[0]['description'] + '\n' + \
odoo_description
if phonecalls[0]['description'].find(odoo_description) != -1:
odoo_description = phonecalls[0]['description'] + '\n' + \
odoo_description
else:
odoo_description = phonecalls[0]['description']
if phonecalls[0]['recording_id']: if phonecalls[0]['recording_id']:
attach_id = phonecalls[0]['recording_id'] attach_id = phonecalls[0]['recording_id']
phonecall_id = phonecalls[0] phonecall_id = phonecalls[0]

25
logcall/views/crm_phonecall_view.xml

@ -7,17 +7,12 @@
<field name="model">crm.phonecall</field> <field name="model">crm.phonecall</field>
<field name="inherit_id" ref="crm_phone.crm_phonecall_form"/> <field name="inherit_id" ref="crm_phone.crm_phonecall_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Phone Call">
<sheet>
<group name="main">
<group name="left">
<xpath expr="//field[@name='date']" position="after">
<field name="end_date"/>
</xpath>
</group>
</group>
</sheet>
</form>
<xpath expr="//field[@name='date']" position="after">
<field name="end_date"/>
</xpath>
<xpath expr="//field[@name='direction']" position="before">
<field name="recording_id"/>
</xpath>
</field> </field>
</record> </record>
@ -39,11 +34,9 @@
<field name="name">crm.phonecall.search</field> <field name="name">crm.phonecall.search</field>
<field name="model">crm.phonecall</field> <field name="model">crm.phonecall</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<search string="Search Phone Calls">
<xpath expr="//field[@name='date']" position="after">
<field name="end_date"/>
</xpath>
</search>
<xpath expr="//field[@name='date']" position="after">
<field name="end_date"/>
</xpath>
</field> </field>
</record> </record>

Loading…
Cancel
Save