Browse Source

[MERGE] merge branch lp:~invitu/openerp-asterisk-connector/openerp-asterisk-connector_7_0 with a large rewrite in order to avoid code duplication.

Set default value to company_id field.
pull/7/head
Alexis de Lattre 12 years ago
parent
commit
213a7d5836
  1. 63
      asterisk_click2dial/asterisk_click2dial.py
  2. 2
      asterisk_click2dial/asterisk_server_view.xml
  3. 10
      asterisk_click2dial/i18n/asterisk_click2dial.pot
  4. 10
      asterisk_click2dial/i18n/fr.po
  5. 12
      asterisk_click2dial/res_partner_view.xml
  6. 1
      asterisk_click2dial/res_users_view.xml
  7. 2
      asterisk_click2dial_crm/__init__.py
  8. 4
      asterisk_click2dial_crm/__openerp__.py
  9. 49
      asterisk_click2dial_crm/asterisk_click2dial_crm.py
  10. 57
      asterisk_click2dial_crm/crm_lead_view.xml
  11. 108
      asterisk_click2dial_crm/i18n/asterisk_click2dial_crm.pot
  12. 122
      asterisk_click2dial_crm/i18n/fr.po
  13. 2
      asterisk_click2dial_crm/wizard/create_crm_phonecall.py

63
asterisk_click2dial/asterisk_click2dial.py

@ -74,6 +74,7 @@ class asterisk_server(osv.osv):
'extension_priority': 1, 'extension_priority': 1,
'wait_time': 15, 'wait_time': 15,
'number_of_digits_to_match_from_end': 9, 'number_of_digits_to_match_from_end': 9,
'company_id': lambda self, cr, uid, context: self.pool.get('res.company')._company_default_get(cr, uid, 'asterisk.server', context=context),
} }
def _check_validity(self, cr, uid, ids): def _check_validity(self, cr, uid, ids):
@ -273,6 +274,7 @@ class asterisk_server(osv.osv):
priority = str(ast_server.extension_priority), priority = str(ast_server.extension_priority),
timeout = str(ast_server.wait_time*1000), timeout = str(ast_server.wait_time*1000),
caller_id = user.callerid, caller_id = user.callerid,
account = user.cdraccount,
variable = variable) variable = variable)
except Exception, e: except Exception, e:
_logger.error("Error in the Originate request to Asterisk server %s" % ast_server.ip_address) _logger.error("Error in the Originate request to Asterisk server %s" % ast_server.ip_address)
@ -335,6 +337,8 @@ class res_users(osv.osv):
help="Caller ID used for the calls initiated by this user."), help="Caller ID used for the calls initiated by this user."),
# You'd probably think : Asterisk should reuse the callerID of sip.conf ! # You'd probably think : Asterisk should reuse the callerID of sip.conf !
# But it cannot, cf http://lists.digium.com/pipermail/asterisk-users/2012-January/269787.html # But it cannot, cf http://lists.digium.com/pipermail/asterisk-users/2012-January/269787.html
'cdraccount': fields.char('CDR Account', size=50,
help="Call Detail Record (CDR) account used for billing this user."),
'asterisk_chan_type': fields.selection([ 'asterisk_chan_type': fields.selection([
('SIP', 'SIP'), ('SIP', 'SIP'),
('IAX2', 'IAX2'), ('IAX2', 'IAX2'),
@ -379,43 +383,45 @@ class res_partner(osv.osv):
_inherit = "res.partner" _inherit = "res.partner"
def _format_phonenumber_to_e164(self, cr, uid, ids, name, arg, context=None):
def generic_phonenumber_to_e164(self, cr, uid, ids, object, field_from_to_seq, context=None):
result = {} result = {}
for partner in self.read(cr, uid, ids, ['phone', 'mobile', 'fax'], context=context):
result[partner['id']] = {}
for fromfield, tofield in [('phone', 'phone_e164'), ('mobile', 'mobile_e164'), ('fax', 'fax_e164')]:
if not partner.get(fromfield):
from_field_seq = [item[0] for item in field_from_to_seq]
for record in object.read(cr, uid, ids, from_field_seq, context=context):
result[record['id']] = {}
for fromfield, tofield in field_from_to_seq:
if not record.get(fromfield):
res = False res = False
else: else:
try: try:
res = phonenumbers.format_number(phonenumbers.parse(partner.get(fromfield), None), phonenumbers.PhoneNumberFormat.E164)
res = phonenumbers.format_number(phonenumbers.parse(record.get(fromfield), None), phonenumbers.PhoneNumberFormat.E164)
except Exception, e: except Exception, e:
_logger.error("Cannot reformat the phone number '%s' to E.164 format. Error message: %s" % (partner.get(fromfield), e))
_logger.error("Cannot reformat the phone number '%s' to E.164 format. Error message: %s" % (record.get(fromfield), e))
_logger.error("You should fix this number and run the wizard 'Reformat all phone numbers' from the menu Settings > Configuration > Asterisk") _logger.error("You should fix this number and run the wizard 'Reformat all phone numbers' from the menu Settings > Configuration > Asterisk")
# If I raise an exception here, it won't be possible to install # If I raise an exception here, it won't be possible to install
# the module on a DB with bad phone numbers # the module on a DB with bad phone numbers
#raise osv.except_osv(_('Error :'), _("Cannot reformat the phone number '%s' to E.164 format. Error message: %s" % (partner.get(fromfield), e)))
#raise osv.except_osv(_('Error :'), _("Cannot reformat the phone number '%s' to E.164 format. Error message: %s" % (record.get(fromfield), e)))
res = False res = False
result[partner['id']][tofield] = res
#print "RESULT _format_phonenumber_to_e164", result
result[record['id']][tofield] = res
print "RESULT generic_phonenumber_to_e164", result
return result return result
def format_phonenumber_to_e164(self, cr, uid, ids, name, arg, context=None):
return self.generic_phonenumber_to_e164(cr, uid, ids, self, [('phone', 'phone_e164'), ('mobile', 'mobile_e164'), ('fax', 'fax_e164')], context=context)
_columns = { _columns = {
'phone_e164': fields.function(_format_phonenumber_to_e164, type='char', size=64, string='Phone in E.164 format', readonly=True, multi="e164", store={
'phone_e164': fields.function(format_phonenumber_to_e164, type='char', size=64, string='Phone in E.164 format', readonly=True, multi="e164", store={
'res.partner': (lambda self, cr, uid, ids, c={}: ids, ['phone'], 10), 'res.partner': (lambda self, cr, uid, ids, c={}: ids, ['phone'], 10),
}), }),
'mobile_e164': fields.function(_format_phonenumber_to_e164, type='char', size=64, string='Mobile in E.164 format', readonly=True, multi="e164", store={
'mobile_e164': fields.function(format_phonenumber_to_e164, type='char', size=64, string='Mobile in E.164 format', readonly=True, multi="e164", store={
'res.partner': (lambda self, cr, uid, ids, c={}: ids, ['mobile'], 10), 'res.partner': (lambda self, cr, uid, ids, c={}: ids, ['mobile'], 10),
}), }),
'fax_e164': fields.function(_format_phonenumber_to_e164, type='char', size=64, string='Fax in E.164 format', readonly=True, multi="e164", store={
'fax_e164': fields.function(format_phonenumber_to_e164, type='char', size=64, string='Fax in E.164 format', readonly=True, multi="e164", store={
'res.partner': (lambda self, cr, uid, ids, c={}: ids, ['fax'], 10), 'res.partner': (lambda self, cr, uid, ids, c={}: ids, ['fax'], 10),
}), }),
} }
def _reformat_phonenumbers(self, cr, uid, vals, context=None):
def _generic_reformat_phonenumbers(self, cr, uid, vals, phonefields=['phone', 'fax', 'mobile'], context=None):
"""Reformat phone numbers in international format i.e. +33141981242""" """Reformat phone numbers in international format i.e. +33141981242"""
phonefields = ['phone', 'fax', 'mobile']
if any([vals.get(field) for field in phonefields]): if any([vals.get(field) for field in phonefields]):
user = self.pool['res.users'].browse(cr, uid, uid, context=context) user = self.pool['res.users'].browse(cr, uid, uid, context=context)
# country_id on res.company is a fields.function that looks at # country_id on res.company is a fields.function that looks at
@ -438,18 +444,24 @@ class res_partner(osv.osv):
def create(self, cr, uid, vals, context=None): def create(self, cr, uid, vals, context=None):
vals_reformated = self._reformat_phonenumbers(cr, uid, vals, context=context)
vals_reformated = self._generic_reformat_phonenumbers(cr, uid, vals, context=context)
return super(res_partner, self).create(cr, uid, vals_reformated, context=context) return super(res_partner, self).create(cr, uid, vals_reformated, context=context)
def write(self, cr, uid, ids, vals, context=None): def write(self, cr, uid, ids, vals, context=None):
vals_reformated = self._reformat_phonenumbers(cr, uid, vals, context=context)
vals_reformated = self._generic_reformat_phonenumbers(cr, uid, vals, context=context)
return super(res_partner, self).write(cr, uid, ids, vals_reformated, context=context) return super(res_partner, self).write(cr, uid, ids, vals_reformated, context=context)
def dial(self, cr, uid, ids, phone_field=['phone', 'phone_e164'], context=None):
def generic_dial(self, cr, uid, ids, object, context=None):
'''Read the number to dial and call _connect_to_asterisk the right way''' '''Read the number to dial and call _connect_to_asterisk the right way'''
erp_number_read = self.read(cr, uid, ids[0], phone_field, context=context)
if context is None:
context = {}
if not isinstance(context.get('field2dial'), list):
raise osv.except_osv(_('Error :'), "The function action_dial must be called with a 'field2dial' key in the context containing a list ['<phone_field_displayed>', '<phone_field_e164>'].")
else:
phone_field = context.get('field2dial')
erp_number_read = object.read(cr, uid, ids[0], phone_field, context=context)
erp_number_e164 = erp_number_read[phone_field[1]] erp_number_e164 = erp_number_read[phone_field[1]]
erp_number_display = erp_number_read[phone_field[0]] erp_number_display = erp_number_read[phone_field[0]]
# Check if the number to dial is not empty # Check if the number to dial is not empty
@ -460,16 +472,9 @@ class res_partner(osv.osv):
return self.pool['asterisk.server']._dial_with_asterisk(cr, uid, erp_number_e164, context=context) return self.pool['asterisk.server']._dial_with_asterisk(cr, uid, erp_number_e164, context=context)
def action_dial_phone(self, cr, uid, ids, context=None):
'''Function called by the button 'Dial' next to the 'phone' field
in the partner view'''
return self.dial(cr, uid, ids, phone_field=['phone', 'phone_e164'], context=context)
def action_dial_mobile(self, cr, uid, ids, context=None):
'''Function called by the button 'Dial' next to the 'mobile' field
in the partner view'''
return self.dial(cr, uid, ids, phone_field=['mobile', 'mobile_e164'], context=context)
def action_dial(self, cr, uid, ids, context=None):
'''Function called by the button 'Dial' '''
return self.generic_dial(cr, uid, ids, self, context=context)
def get_name_from_phone_number(self, cr, uid, number, context=None): def get_name_from_phone_number(self, cr, uid, number, context=None):

2
asterisk_click2dial/asterisk_server_view.xml

@ -48,7 +48,7 @@
</h1> </h1>
</div> </div>
<group> <group>
<field name="company_id" invisible="not context.get('asterisk_server_main_view', False)" />
<field name="company_id" invisible="not context.get('asterisk_server_main_view', False)" groups="base.group_multi_company"/>
<field name="active" /> <field name="active" />
<field name="ip_address" /> <field name="ip_address" />
<field name="port" /> <field name="port" />

10
asterisk_click2dial/i18n/asterisk_click2dial.pot

@ -41,6 +41,11 @@ msgstr "Current phone"
msgid "Caller ID" msgid "Caller ID"
msgstr "Identification de l'appelant" msgstr "Identification de l'appelant"
#. module: asterisk_click2dial
#: field:res.users,cdraccount:0
msgid "CDR Account"
msgstr ""
#. module: asterisk_click2dial #. module: asterisk_click2dial
#: field:asterisk.server,wait_time:0 #: field:asterisk.server,wait_time:0
msgid "Wait time (sec)" msgid "Wait time (sec)"
@ -254,6 +259,11 @@ msgstr "Erreur :"
msgid "User's internal phone number." msgid "User's internal phone number."
msgstr "Numéro de téléphone interne de l'utilisateur." msgstr "Numéro de téléphone interne de l'utilisateur."
#. module: asterisk_click2dial
#: help:res.users,cdraccount:0
msgid "Call Detail Record (CDR) account used for billing this user."
msgstr ""
#. module: asterisk_click2dial #. module: asterisk_click2dial
#: model:ir.actions.act_window,name:asterisk_click2dial.action_open_calling_partner #: model:ir.actions.act_window,name:asterisk_click2dial.action_open_calling_partner
#: model:ir.ui.menu,name:asterisk_click2dial.menu_open_calling_partner_sales #: model:ir.ui.menu,name:asterisk_click2dial.menu_open_calling_partner_sales

10
asterisk_click2dial/i18n/fr.po

@ -41,6 +41,11 @@ msgstr "Tél. actuel"
msgid "Caller ID" msgid "Caller ID"
msgstr "Identification de l'appelant" msgstr "Identification de l'appelant"
#. module: asterisk_click2dial
#: field:res.users,cdraccount:0
msgid "CDR Account"
msgstr "Compte CDR"
#. module: asterisk_click2dial #. module: asterisk_click2dial
#: field:asterisk.server,wait_time:0 #: field:asterisk.server,wait_time:0
msgid "Wait time (sec)" msgid "Wait time (sec)"
@ -103,6 +108,11 @@ msgstr "Mettre à jour un contact existant"
msgid "Internal number" msgid "Internal number"
msgstr "Numéro interne" msgstr "Numéro interne"
#. module: asterisk_click2dial
#: help:res.users,cdraccount:0
msgid "Call Detail Record (CDR) account used for billing this user."
msgstr "Compte CDR utilisé pour facturer cet utilisateur (CDR = Journal d'appel détaillé)."
#. module: asterisk_click2dial #. module: asterisk_click2dial
#: field:res.users,asterisk_chan_type:0 #: field:res.users,asterisk_chan_type:0
msgid "Asterisk channel type" msgid "Asterisk channel type"

12
asterisk_click2dial/res_partner_view.xml

@ -20,13 +20,13 @@
<field name="phone" position="replace"> <field name="phone" position="replace">
<group colspan="2" col="8"> <group colspan="2" col="8">
<field name="phone" colspan="7" /> <field name="phone" colspan="7" />
<button name="action_dial_phone" string="Dial" type="object" attrs="{'invisible':[('phone','=',False)]}"/>
<button name="action_dial" context="{'field2dial': ['phone', 'phone_e164']}" string="Dial" type="object" attrs="{'invisible':[('phone','=',False)]}"/>
</group> </group>
</field> </field>
<field name="mobile" position="replace"> <field name="mobile" position="replace">
<group colspan="2" col="8"> <group colspan="2" col="8">
<field name="mobile" colspan="7" /> <field name="mobile" colspan="7" />
<button name="action_dial_mobile" string="Dial" type="object" attrs="{'invisible':[('mobile','=',False)]}"/>
<button name="action_dial" context="{'field2dial': ['mobile', 'mobile_e164']}" string="Dial" type="object" attrs="{'invisible':[('mobile','=',False)]}"/>
</group> </group>
</field> </field>
</field> </field>
@ -41,25 +41,25 @@
<xpath expr="//group/group/field[@name='phone']" position="replace"> <xpath expr="//group/group/field[@name='phone']" position="replace">
<group colspan="2" col="8"> <group colspan="2" col="8">
<field name="phone" colspan="7" /> <field name="phone" colspan="7" />
<button name="action_dial_phone" string="Dial" type="object" attrs="{'invisible':[('phone','=',False)]}"/>
<button name="action_dial" context="{'field2dial': ['phone', 'phone_e164']}" string="Dial" type="object" attrs="{'invisible':[('phone','=',False)]}"/>
</group> </group>
</xpath> </xpath>
<xpath expr="//group/group/field[@name='mobile']" position="replace"> <xpath expr="//group/group/field[@name='mobile']" position="replace">
<group colspan="2" col="8"> <group colspan="2" col="8">
<field name="mobile" colspan="7" /> <field name="mobile" colspan="7" />
<button name="action_dial_mobile" string="Dial" type="object" attrs="{'invisible':[('mobile','=',False)]}"/>
<button name="action_dial" context="{'field2dial': ['mobile', 'mobile_e164']}" string="Dial" type="object" attrs="{'invisible':[('mobile','=',False)]}"/>
</group> </group>
</xpath> </xpath>
<xpath expr="//form[@string='Contact']/sheet/group/field[@name='phone']" position="replace"> <xpath expr="//form[@string='Contact']/sheet/group/field[@name='phone']" position="replace">
<group colspan="2" col="8"> <group colspan="2" col="8">
<field name="phone" colspan="7" /> <field name="phone" colspan="7" />
<button name="action_dial_phone" string="Dial" type="object" attrs="{'invisible':[('phone','=',False)]}"/>
<button name="action_dial" context="{'field2dial': ['phone', 'phone_e164']}" string="Dial" type="object" attrs="{'invisible':[('phone','=',False)]}"/>
</group> </group>
</xpath> </xpath>
<xpath expr="//form[@string='Contact']/sheet/group/field[@name='mobile']" position="replace"> <xpath expr="//form[@string='Contact']/sheet/group/field[@name='mobile']" position="replace">
<group colspan="2" col="8"> <group colspan="2" col="8">
<field name="mobile" colspan="7" /> <field name="mobile" colspan="7" />
<button name="action_dial_mobile" string="Dial" type="object" attrs="{'invisible':[('mobile','=',False)]}"/>
<button name="action_dial" context="{'field2dial': ['mobile', 'mobile_e164']}" string="Dial" type="object" attrs="{'invisible':[('mobile','=',False)]}"/>
</group> </group>
</xpath> </xpath>
</field> </field>

1
asterisk_click2dial/res_users_view.xml

@ -25,6 +25,7 @@
<field name="asterisk_server_id"/> <field name="asterisk_server_id"/>
</group> </group>
<group name="optional_params" string="Optional parameters - for experts only, can be left empty"> <group name="optional_params" string="Optional parameters - for experts only, can be left empty">
<field name="cdraccount"/>
<field name="dial_suffix"/> <field name="dial_suffix"/>
<field name="alert_info"/> <field name="alert_info"/>
<field name="variable"/> <field name="variable"/>

2
asterisk_click2dial_crm/__init__.py

@ -2,7 +2,7 @@
############################################################################## ##############################################################################
# #
# Asterisk click2dial CRM module for OpenERP # Asterisk click2dial CRM module for OpenERP
# Copyright (c) 2011 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
# Copyright (c) 2011 Zikzakmedia S.L. (http://zikzakmedia.com)
# Copyright (c) 2012-2013 Akretion (http://www.akretion.com) # Copyright (c) 2012-2013 Akretion (http://www.akretion.com)
# @author: Jesús Martín <jmartin@zikzakmedia.com> # @author: Jesús Martín <jmartin@zikzakmedia.com>
# @author: Alexis de Lattre <alexis.delattre@akretion.com> # @author: Alexis de Lattre <alexis.delattre@akretion.com>

4
asterisk_click2dial_crm/__openerp__.py

@ -2,7 +2,7 @@
############################################################################## ##############################################################################
# #
# Asterisk click2dial CRM module for OpenERP # Asterisk click2dial CRM module for OpenERP
# Copyright (c) 2011 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
# Copyright (c) 2011 Zikzakmedia S.L. (http://zikzakmedia.com)
# Copyright (c) 2012-2013 Akretion (http://www.akretion.com) # Copyright (c) 2012-2013 Akretion (http://www.akretion.com)
# @author: Jesús Martín <jmartin@zikzakmedia.com> # @author: Jesús Martín <jmartin@zikzakmedia.com>
# @author: Alexis de Lattre <alexis.delattre@akretion.com> # @author: Alexis de Lattre <alexis.delattre@akretion.com>
@ -59,6 +59,8 @@
'wizard/open_calling_partner_view.xml', 'wizard/open_calling_partner_view.xml',
'wizard/create_crm_phonecall_view.xml', 'wizard/create_crm_phonecall_view.xml',
'res_users_view.xml', 'res_users_view.xml',
'crm_lead_view.xml',
], ],
"installable": True, "installable": True,
"application": True,
} }

49
asterisk_click2dial_crm/asterisk_click2dial_crm.py

@ -2,8 +2,9 @@
############################################################################## ##############################################################################
# #
# Asterisk click2dial CRM module for OpenERP # Asterisk click2dial CRM module for OpenERP
# Copyright (c) 2011 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
# Copyright (c) 2011 Zikzakmedia S.L. (http://zikzakmedia.com)
# Copyright (c) 2012-2013 Akretion (http://www.akretion.com) # Copyright (c) 2012-2013 Akretion (http://www.akretion.com)
# Copyright (C) 2013 Invitu <contact@invitu.com>
# @author: Jesús Martín <jmartin@zikzakmedia.com> # @author: Jesús Martín <jmartin@zikzakmedia.com>
# @author: Alexis de Lattre <alexis.delattre@akretion.com> # @author: Alexis de Lattre <alexis.delattre@akretion.com>
# #
@ -23,8 +24,19 @@
############################################################################## ##############################################################################
from openerp.osv import osv, fields from openerp.osv import osv, fields
# Lib required to print logs
import logging
# Lib to translate error messages # Lib to translate error messages
from openerp.tools.translate import _ from openerp.tools.translate import _
# Lib for phone number reformating -> pip install phonenumbers
import phonenumbers
# Lib py-asterisk from http://code.google.com/p/py-asterisk/
# We need a version which has this commit : http://code.google.com/p/py-asterisk/source/detail?r=8d0e1c941cce727c702582f3c9fcd49beb4eeaa4
# so a version after Nov 20th, 2012
from Asterisk import Manager
_logger = logging.getLogger(__name__)
class res_partner(osv.osv): class res_partner(osv.osv):
_inherit = "res.partner" _inherit = "res.partner"
@ -71,3 +83,38 @@ class res_users(osv.osv):
'context_propose_creation_crm_call': True, 'context_propose_creation_crm_call': True,
} }
class crm_lead(osv.osv):
_inherit = "crm.lead"
def format_phonenumber_to_e164(self, cr, uid, ids, name, arg, context=None):
return self.pool['res.partner'].generic_phonenumber_to_e164(cr, uid, ids, self, [('phone', 'phone_e164'), ('mobile', 'mobile_e164'), ('fax', 'fax_e164')], context=context)
_columns = {
'phone_e164': fields.function(format_phonenumber_to_e164, type='char', size=64, string='Phone in E.164 format', readonly=True, multi="e164lead", store={
'crm.lead': (lambda self, cr, uid, ids, c={}: ids, ['phone'], 10),
}),
'mobile_e164': fields.function(format_phonenumber_to_e164, type='char', size=64, string='Mobile in E.164 format', readonly=True, multi="e164lead", store={
'crm.lead': (lambda self, cr, uid, ids, c={}: ids, ['mobile'], 10),
}),
'fax_e164': fields.function(format_phonenumber_to_e164, type='char', size=64, string='Fax in E.164 format', readonly=True, multi="e164lead", store={
'crm.lead': (lambda self, cr, uid, ids, c={}: ids, ['fax'], 10),
}),
}
def create(self, cr, uid, vals, context=None):
vals_reformated = self.pool['res.partner']._generic_reformat_phonenumbers(cr, uid, vals, context=context)
return super(crm_lead, self).create(cr, uid, vals_reformated, context=context)
def write(self, cr, uid, ids, vals, context=None):
vals_reformated = self.pool['res.partner']._generic_reformat_phonenumbers(cr, uid, vals, context=context)
return super(crm_lead, self).write(cr, uid, ids, vals_reformated, context=context)
def action_dial(self, cr, uid, ids, context=None):
'''Function called by the button 'Dial' in the lead view'''
return self.pool['res.partner'].generic_dial(cr, uid, ids, self, context=context)

57
asterisk_click2dial_crm/crm_lead_view.xml

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Asterisk Click2dial module for OpenERP
Copyright (C) 2010-2013 Alexis de Lattre <alexis@via.ecp.fr>
Copyright (C) 2010-2013 Invitu <contact@invitu.com>
The licence is in the file __openerp__.py
Inherit lead views to add 'Dial' button next to 'phone'
and 'mobile' fields
-->
<openerp>
<data>
<record id="asterisk_crm_lead_simplified_form_dial" model="ir.ui.view">
<field name="name">asterisk.crm_lead.simplified.form.dial</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_form_view_leads"/>
<field name="arch" type="xml">
<xpath expr="//group/group/field[@name='phone']" position="replace">
<group colspan="2" col="8">
<field name="phone" colspan="7" />
<button name="action_dial" context="{'field2dial': ['phone', 'phone_e164']}" string="Dial" type="object" attrs="{'invisible':[('phone','=',False)]}"/>
</group>
</xpath>
<xpath expr="//group/group/field[@name='mobile']" position="replace">
<group colspan="2" col="8">
<field name="mobile" colspan="7" />
<button name="action_dial" context="{'field2dial': ['mobile', 'mobile_e164']}" string="Dial" type="object" attrs="{'invisible':[('mobile','=',False)]}"/>
</group>
</xpath>
</field>
</record>
<record id="asterisk_crm_case_form_view_oppor_dial" model="ir.ui.view">
<field name="name">asterisk.crm_case.form.view_oppor.dial</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_form_view_oppor"/>
<field name="arch" type="xml">
<xpath expr="//group/group/field[@name='phone']" position="replace">
<group colspan="2" col="8">
<field name="phone" colspan="7" />
<button name="action_dial" context="{'field2dial': ['phone', 'phone_e164']}" string="Dial" type="object" attrs="{'invisible':[('phone','=',False)]}"/>
</group>
</xpath>
<xpath expr="//group/group/field[@name='mobile']" position="replace">
<group colspan="2" col="8">
<field name="mobile" colspan="7" />
<button name="action_dial" context="{'field2dial': ['mobile', 'mobile_e164']}" string="Dial" type="object" attrs="{'invisible':[('mobile','=',False)]}"/>
</group>
</xpath>
</field>
</record>
</data>
</openerp>

108
asterisk_click2dial_crm/i18n/asterisk_click2dial_crm.pot

@ -4,10 +4,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: OpenERP Server 6.1\n"
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-06-02 23:46+0000\n"
"PO-Revision-Date: 2012-06-02 23:46+0000\n"
"POT-Creation-Date: 2013-05-09 18:57+0000\n"
"PO-Revision-Date: 2013-05-09 18:57+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -16,39 +16,66 @@ msgstr ""
"Plural-Forms: \n" "Plural-Forms: \n"
#. module: asterisk_click2dial_crm #. module: asterisk_click2dial_crm
#: model:ir.actions.act_window,name:asterisk_click2dial_crm.action_create_crm_phonecall
msgid "Create CRM phonecall"
#: view:crm.lead:0
msgid "Dial"
msgstr "" msgstr ""
#. module: asterisk_click2dial_crm #. module: asterisk_click2dial_crm
#: code:addons/asterisk_click2dial_crm/wizard/create_crm_phonecall.py:45
#, python-format
msgid "Call with"
#: view:wizard.create.crm.phonecall:0
msgid "CRM phone call"
msgstr "" msgstr ""
#. module: asterisk_click2dial_crm #. module: asterisk_click2dial_crm
#: view:wizard.open.calling.partner:0
msgid "Create call in CRM"
#: view:wizard.create.crm.phonecall:0
msgid "No"
msgstr "" msgstr ""
#. module: asterisk_click2dial_crm #. module: asterisk_click2dial_crm
#: view:wizard.create.crm.phonecall:0
msgid "CRM phone call"
#: model:ir.model,name:asterisk_click2dial_crm.model_wizard_create_crm_phonecall
msgid "wizard.create.crm.phonecall"
msgstr ""
#. module: asterisk_click2dial_crm
#: field:crm.lead,phone_e164:0
msgid "Phone in E.164 format"
msgstr ""
#. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_crm_lead
msgid "Lead/Opportunity"
msgstr "" msgstr ""
#. module: asterisk_click2dial_crm #. module: asterisk_click2dial_crm
#: view:wizard.create.crm.phonecall:0 #: view:wizard.create.crm.phonecall:0
msgid "No"
msgid "Create a phone call in the CRM ?"
msgstr "" msgstr ""
#. module: asterisk_click2dial_crm #. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_wizard_open_calling_partner
msgid "wizard.open.calling.partner"
#: code:addons/asterisk_click2dial_crm/asterisk_click2dial_crm.py:166
#, python-format
msgid "The phone number isn't stored in the standard E.164 format. Try to run the wizard 'Reformat all phone numbers' from the menu Settings > Configuration > Asterisk."
msgstr "" msgstr ""
#. module: asterisk_click2dial_crm #. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_wizard_create_crm_phonecall
msgid "wizard.create.crm.phonecall"
#: code:addons/asterisk_click2dial_crm/asterisk_click2dial_crm.py:134
#, python-format
msgid "You should set a country on the company '%s'"
msgstr ""
#. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_res_users
msgid "Users"
msgstr ""
#. module: asterisk_click2dial_crm
#: field:crm.lead,fax_e164:0
msgid "Fax in E.164 format"
msgstr ""
#. module: asterisk_click2dial_crm
#: code:addons/asterisk_click2dial_crm/asterisk_click2dial_crm.py:141
#, python-format
msgid "Cannot reformat the phone number '%s' to international format. Error message: %s"
msgstr "" msgstr ""
#. module: asterisk_click2dial_crm #. module: asterisk_click2dial_crm
@ -57,22 +84,53 @@ msgid "Propose to create a call in CRM after a click2dial"
msgstr "" msgstr ""
#. module: asterisk_click2dial_crm #. module: asterisk_click2dial_crm
#: view:wizard.create.crm.phonecall:0
msgid "Create a phone call in the CRM ?"
#: code:addons/asterisk_click2dial_crm/asterisk_click2dial_crm.py:134
#: code:addons/asterisk_click2dial_crm/asterisk_click2dial_crm.py:141
#: code:addons/asterisk_click2dial_crm/asterisk_click2dial_crm.py:164
#: code:addons/asterisk_click2dial_crm/asterisk_click2dial_crm.py:166
#, python-format
msgid "Error :"
msgstr "" msgstr ""
#. module: asterisk_click2dial_crm #. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_res_users
msgid "res.users"
#: model:ir.actions.act_window,name:asterisk_click2dial_crm.action_create_crm_phonecall
msgid "Create CRM phonecall"
msgstr "" msgstr ""
#. module: asterisk_click2dial_crm #. module: asterisk_click2dial_crm
#: view:wizard.create.crm.phonecall:0
msgid "Yes"
#: view:wizard.open.calling.partner:0
msgid "Create Call in CRM"
msgstr ""
#. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_wizard_open_calling_partner
#: model:ir.ui.menu,name:asterisk_click2dial_crm.menu_open_calling_partner_phone
msgid "Open calling partner"
msgstr ""
#. module: asterisk_click2dial_crm
#: field:crm.lead,mobile_e164:0
msgid "Mobile in E.164 format"
msgstr ""
#. module: asterisk_click2dial_crm
#: view:res.users:0
msgid "Telephony preferences"
msgstr ""
#. module: asterisk_click2dial_crm
#: code:addons/asterisk_click2dial_crm/asterisk_click2dial_crm.py:164
#, python-format
msgid "There is no phone number !"
msgstr ""
#. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_res_partner
msgid "Partner"
msgstr "" msgstr ""
#. module: asterisk_click2dial_crm #. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_res_partner_address
msgid "Partner Addresses"
#: view:wizard.create.crm.phonecall:0
msgid "Yes"
msgstr "" msgstr ""

122
asterisk_click2dial_crm/i18n/fr.po

@ -4,10 +4,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: OpenERP Server 6.1\n"
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-06-02 23:47+0000\n"
"PO-Revision-Date: 2012-06-02 23:47+0000\n"
"POT-Creation-Date: 2013-05-09 19:00+0000\n"
"PO-Revision-Date: 2013-05-09 19:00+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -16,20 +16,9 @@ msgstr ""
"Plural-Forms: \n" "Plural-Forms: \n"
#. module: asterisk_click2dial_crm #. module: asterisk_click2dial_crm
#: model:ir.actions.act_window,name:asterisk_click2dial_crm.action_create_crm_phonecall
msgid "Create CRM phonecall"
msgstr "Créer un appel dans la CRM"
#. module: asterisk_click2dial_crm
#: code:addons/asterisk_click2dial_crm/wizard/create_crm_phonecall.py:45
#, python-format
msgid "Call with"
msgstr "Conversation avec"
#. module: asterisk_click2dial_crm
#: view:wizard.open.calling.partner:0
msgid "Create call in CRM"
msgstr "Créer un appel dans la CRM"
#: view:crm.lead:0
msgid "Dial"
msgstr "Appeler"
#. module: asterisk_click2dial_crm #. module: asterisk_click2dial_crm
#: view:wizard.create.crm.phonecall:0 #: view:wizard.create.crm.phonecall:0
@ -41,38 +30,107 @@ msgstr "Appel dans la CRM"
msgid "No" msgid "No"
msgstr "Non" msgstr "Non"
#. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_wizard_open_calling_partner
msgid "wizard.open.calling.partner"
msgstr "wizard.open.calling.partner"
#. module: asterisk_click2dial_crm #. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_wizard_create_crm_phonecall #: model:ir.model,name:asterisk_click2dial_crm.model_wizard_create_crm_phonecall
msgid "wizard.create.crm.phonecall" msgid "wizard.create.crm.phonecall"
msgstr "wizard.create.crm.phonecall" msgstr "wizard.create.crm.phonecall"
#. module: asterisk_click2dial_crm #. module: asterisk_click2dial_crm
#: field:res.users,context_propose_creation_crm_call:0
msgid "Propose to create a call in CRM after a click2dial"
msgstr "Propose de créer un appel dans la CRM après un click2dial"
#: field:crm.lead,phone_e164:0
msgid "Phone in E.164 format"
msgstr "Phone in E.164 format"
#. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_crm_lead
msgid "Lead/Opportunity"
msgstr "Piste/opportunité"
#. module: asterisk_click2dial_crm #. module: asterisk_click2dial_crm
#: view:wizard.create.crm.phonecall:0 #: view:wizard.create.crm.phonecall:0
msgid "Create a phone call in the CRM ?" msgid "Create a phone call in the CRM ?"
msgstr "Créer un appel téléphonique dans la CRM ?" msgstr "Créer un appel téléphonique dans la CRM ?"
#. module: asterisk_click2dial_crm
#: code:addons/asterisk_click2dial_crm/asterisk_click2dial_crm.py:166
#, python-format
msgid "The phone number isn't stored in the standard E.164 format. Try to run the wizard 'Reformat all phone numbers' from the menu Settings > Configuration > Asterisk."
msgstr "The phone number isn't stored in the standard E.164 format. Try to run the wizard 'Reformat all phone numbers' from the menu Settings > Configuration > Asterisk."
#. module: asterisk_click2dial_crm
#: code:addons/asterisk_click2dial_crm/asterisk_click2dial_crm.py:134
#, python-format
msgid "You should set a country on the company '%s'"
msgstr "You should set a country on the company '%s'"
#. module: asterisk_click2dial_crm #. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_res_users #: model:ir.model,name:asterisk_click2dial_crm.model_res_users
msgid "res.users"
msgstr "res.users"
msgid "Users"
msgstr "Utilisateurs"
#. module: asterisk_click2dial_crm
#: field:crm.lead,fax_e164:0
msgid "Fax in E.164 format"
msgstr "Fax in E.164 format"
#. module: asterisk_click2dial_crm
#: code:addons/asterisk_click2dial_crm/asterisk_click2dial_crm.py:141
#, python-format
msgid "Cannot reformat the phone number '%s' to international format. Error message: %s"
msgstr "Cannot reformat the phone number '%s' to international format. Error message: %s"
#. module: asterisk_click2dial_crm
#: field:res.users,context_propose_creation_crm_call:0
msgid "Propose to create a call in CRM after a click2dial"
msgstr "Propose de créer un appel dans la CRM après un click2dial"
#. module: asterisk_click2dial_crm
#: code:addons/asterisk_click2dial_crm/asterisk_click2dial_crm.py:134
#: code:addons/asterisk_click2dial_crm/asterisk_click2dial_crm.py:141
#: code:addons/asterisk_click2dial_crm/asterisk_click2dial_crm.py:164
#: code:addons/asterisk_click2dial_crm/asterisk_click2dial_crm.py:166
#, python-format
msgid "Error :"
msgstr "Erreur :"
#. module: asterisk_click2dial_crm
#: model:ir.actions.act_window,name:asterisk_click2dial_crm.action_create_crm_phonecall
msgid "Create CRM phonecall"
msgstr "Créer un appel dans la CRM"
#. module: asterisk_click2dial_crm
#: view:wizard.open.calling.partner:0
msgid "Create Call in CRM"
msgstr "Créer Appel dans CRM"
#. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_wizard_open_calling_partner
#: model:ir.ui.menu,name:asterisk_click2dial_crm.menu_open_calling_partner_phone
msgid "Open calling partner"
msgstr "Ouvrir le partenaire appelant"
#. module: asterisk_click2dial_crm
#: field:crm.lead,mobile_e164:0
msgid "Mobile in E.164 format"
msgstr "Mobile in E.164 format"
#. module: asterisk_click2dial_crm
#: view:res.users:0
msgid "Telephony preferences"
msgstr "Préférences Téléphonie"
#. module: asterisk_click2dial_crm
#: code:addons/asterisk_click2dial_crm/asterisk_click2dial_crm.py:164
#, python-format
msgid "There is no phone number !"
msgstr "Il n'y a pas de n° de téléphone !"
#. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_res_partner
msgid "Partner"
msgstr "Partenaire"
#. module: asterisk_click2dial_crm #. module: asterisk_click2dial_crm
#: view:wizard.create.crm.phonecall:0 #: view:wizard.create.crm.phonecall:0
msgid "Yes" msgid "Yes"
msgstr "Oui" msgstr "Oui"
#. module: asterisk_click2dial_crm
#: model:ir.model,name:asterisk_click2dial_crm.model_res_partner_address
msgid "Partner Addresses"
msgstr "Carnet d'adresses"

2
asterisk_click2dial_crm/wizard/create_crm_phonecall.py

@ -2,7 +2,7 @@
############################################################################## ##############################################################################
# #
# Asterisk click2dial CRM module for OpenERP # Asterisk click2dial CRM module for OpenERP
# Copyright (c) 2011 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
# Copyright (c) 2011 Zikzakmedia S.L. (http://zikzakmedia.com)
# Copyright (c) 2012-2013 Akretion (http://www.akretion.com) # Copyright (c) 2012-2013 Akretion (http://www.akretion.com)
# @author: Jesús Martín <jmartin@zikzakmedia.com> # @author: Jesús Martín <jmartin@zikzakmedia.com>
# @author: Alexis de Lattre <alexis.delattre@akretion.com> # @author: Alexis de Lattre <alexis.delattre@akretion.com>

Loading…
Cancel
Save