Browse Source
[MERGE] Merge branch lp:~invitu/openerp-asterisk-connector/openerp-asterisk-connector_7_0 with minor modifications :
[MERGE] Merge branch lp:~invitu/openerp-asterisk-connector/openerp-asterisk-connector_7_0 with minor modifications :
- move function _generic_reformat_phonenumbers to asterisk.common - add "Dial" button on CRM claim form Thanks to Invitu for this contribution !pull/7/head
Alexis de Lattre
12 years ago
8 changed files with 114 additions and 33 deletions
-
45asterisk_click2dial/asterisk_click2dial.py
-
4asterisk_click2dial/wizard/reformat_all_phonenumbers.py
-
5asterisk_click2dial_crm/__openerp__.py
-
4asterisk_click2dial_crm/asterisk_click2dial_crm.py
-
1asterisk_click2dial_crm_claim/__init__.py
-
10asterisk_click2dial_crm_claim/__openerp__.py
-
49asterisk_click2dial_crm_claim/asterisk_click2dial_crm_claim.py
-
29asterisk_click2dial_crm_claim/crm_claim_view.xml
@ -0,0 +1,49 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Asterisk click2dial CRM Claim module for OpenERP |
|||
# Copyright (C) 2013 Invitu <contact@invitu.com> |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as published by |
|||
# the Free Software Foundation, either version 3 of the License, or |
|||
# (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
from openerp.osv import osv, fields |
|||
|
|||
|
|||
class crm_claim(osv.osv): |
|||
_name = 'crm.claim' |
|||
_inherit = ['crm.claim', 'asterisk.common'] |
|||
|
|||
|
|||
def format_phonenumber_to_e164(self, cr, uid, ids, name, arg, context=None): |
|||
return self.generic_phonenumber_to_e164(cr, uid, ids, [('partner_phone', 'partner_phone_e164')], context=context) |
|||
|
|||
|
|||
_columns = { |
|||
'partner_phone_e164': fields.function(format_phonenumber_to_e164, type='char', size=64, string='Phone in E.164 format', readonly=True, store={ |
|||
'crm.claim': (lambda self, cr, uid, ids, c={}: ids, ['partner_phone'], 10), |
|||
}), |
|||
} |
|||
|
|||
|
|||
def create(self, cr, uid, vals, context=None): |
|||
vals_reformated = self._generic_reformat_phonenumbers(cr, uid, vals, context=context) |
|||
return super(crm_claim, self).create(cr, uid, vals_reformated, context=context) |
|||
|
|||
|
|||
def write(self, cr, uid, ids, vals, context=None): |
|||
vals_reformated = self._generic_reformat_phonenumbers(cr, uid, vals, context=context) |
|||
return super(crm_claim, self).write(cr, uid, ids, vals_reformated, context=context) |
|||
|
@ -0,0 +1,29 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
Asterisk Click2dial CRM Claim module for OpenERP |
|||
Copyright (C) 2013 Invitu <contact@invitu.com> |
|||
The licence is in the file __openerp__.py |
|||
|
|||
Inherit crm_claim view to add 'Dial' button next to 'phone' |
|||
field |
|||
--> |
|||
|
|||
<openerp> |
|||
<data> |
|||
|
|||
<record id="asterisk_crm_claim_form_dial" model="ir.ui.view"> |
|||
<field name="name">asterisk.crm_claim.form.dial</field> |
|||
<field name="model">crm.claim</field> |
|||
<field name="inherit_id" ref="crm_claim.crm_case_claims_form_view"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="partner_phone" position="replace"> |
|||
<group colspan="2" col="3"> |
|||
<field name="partner_phone" colspan="2" /> |
|||
<button name="action_dial" context="{'field2dial': ['partner_phone', 'partner_phone_e164']}" string="Dial" type="object" attrs="{'invisible':[('partner_phone','=',False)]}"/> |
|||
</group> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue