Browse Source
Feature "Open Calling Partner" replaced by "Open Caller", with a completely new behavior
Feature "Open Calling Partner" replaced by "Open Caller", with a completely new behavior
As a consequence, the modules asterisk_click2dial_event and asterisk_click2dial_crm_claim have been dropped New wizard "Number not found" (inspired by the old "Open Calling Partner" with many enhancements), which is called by base_phone_popup and Open Caller Formatting of number for click2dial is now handled by the phonenumbers lib: as a consequence, 3 fields have been dropped from asterisk.server (national_prefix, international_prefix, country_prefix) New option 'dial_button_invisible' in the phone widget New sample script asterisk_click2dial/scripts/openerp_popup_timeout.sh Update translations and some module descriptions All the modules are now PEP8 compliantpull/7/head
Alexis de Lattre
10 years ago
48 changed files with 1596 additions and 1480 deletions
-
2asterisk_click2dial/__init__.py
-
60asterisk_click2dial/__openerp__.py
-
476asterisk_click2dial/asterisk_click2dial.py
-
1asterisk_click2dial/asterisk_click2dial_demo.xml
-
4asterisk_click2dial/asterisk_server_view.xml
-
18asterisk_click2dial/controller.py
-
367asterisk_click2dial/i18n/asterisk_click2dial.pot
-
413asterisk_click2dial/i18n/fr.po
-
27asterisk_click2dial/scripts/openerp_popup_timeout.sh
-
77asterisk_click2dial/scripts/set_name_agi.py
-
4asterisk_click2dial/static/src/css/asterisk_click2dial.css
-
58asterisk_click2dial/static/src/js/asterisk_click2dial.js
-
8asterisk_click2dial/static/src/xml/asterisk_click2dial.xml
-
22asterisk_click2dial/wizard/__init__.py
-
223asterisk_click2dial/wizard/open_calling_partner.py
-
51asterisk_click2dial/wizard/open_calling_partner_view.xml
-
1asterisk_click2dial_crm/__openerp__.py
-
11asterisk_click2dial_crm/asterisk_click2dial_crm.py
-
7asterisk_click2dial_crm/i18n/asterisk_click2dial_crm.pot
-
7asterisk_click2dial_crm/i18n/fr.po
-
12asterisk_click2dial_crm/wizard/create_crm_phonecall.py
-
24asterisk_click2dial_crm/wizard/open_calling_partner_view.xml
-
46asterisk_click2dial_crm_claim/__openerp__.py
-
23asterisk_click2dial_crm_claim/wizard/__init__.py
-
32asterisk_click2dial_crm_claim/wizard/open_calling_partner.py
-
24asterisk_click2dial_crm_claim/wizard/open_calling_partner_view.xml
-
43asterisk_click2dial_event/__openerp__.py
-
22asterisk_click2dial_event/wizard/__init__.py
-
31asterisk_click2dial_event/wizard/open_calling_partner.py
-
23asterisk_click2dial_event/wizard/open_calling_partner_view.xml
-
1base_phone/__openerp__.py
-
7base_phone/base_phone.py
-
115base_phone/i18n/base_phone.pot
-
121base_phone/i18n/fr.po
-
88base_phone/static/src/js/phone_widget.js
-
1base_phone/wizard/__init__.py
-
130base_phone/wizard/number_not_found.py
-
55base_phone/wizard/number_not_found_view.xml
-
25base_phone_popup/i18n/base_phone_popup.pot
-
32base_phone_popup/i18n/fr.po
-
11base_phone_popup/popup.py
-
1crm_phone/__init__.py
-
1crm_phone/__openerp__.py
-
112crm_phone/i18n/crm_phone.pot
-
112crm_phone/i18n/fr.po
-
6crm_phone/wizard/__init__.py
-
105crm_phone/wizard/number_not_found.py
-
36crm_phone/wizard/number_not_found_view.xml
@ -0,0 +1,27 @@ |
|||
#! /bin/sh |
|||
# -*- encoding: utf-8 -*- |
|||
# |
|||
# Written by Alexis de Lattre <alexis.delattre@akretion.com> |
|||
|
|||
# Example of wrapper for set_name_agi.py which makes sure that the |
|||
# script doesn't take too much time to execute |
|||
|
|||
# Limiting the execution time of set_name_agi.py is important because |
|||
# the script is designed to be executed at the beginning of each |
|||
# incoming or outgoing phone call... and if the script get stucks, the |
|||
# phone call will also get stucks ! |
|||
|
|||
# For Debian Lenny and Ubuntu Lucid, you need to install the package "timeout" |
|||
# For Ubuntu >= Maverick and Debian >= Squeeze, the "timeout" command is shipped |
|||
# in the "coreutils" package |
|||
|
|||
# The first argument of the "timeout" command is the maximum execution time |
|||
# In this example, we chose 2 seconds. |
|||
|
|||
# To test this script manually (i.e. outside of Asterisk), run : |
|||
# echo "agi_callerid:0141401242"|openerp_popup_timeout.sh |
|||
# where 0141401242 is a phone number that could be presented by the calling party |
|||
|
|||
PATH=/usr/local/sbin:/usr/local/bin:/var/lib/asterisk/agi-bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/share/asterisk/agi-bin |
|||
|
|||
timeout 2s set_name_agi.py --server openerp.mycompany.com --database erp_prod --user-id 12 --password "thepasswd" --notify admin demo |
@ -1,22 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Asterisk Click2Dial module for OpenERP |
|||
# Copyright (C) 2012-2014 Alexis de Lattre <alexis@via.ecp.fr> |
|||
# |
|||
# 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 . import open_calling_partner |
@ -1,223 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Asterisk Click2dial module for OpenERP |
|||
# Copyright (C) 2010-2013 Alexis de Lattre <alexis@via.ecp.fr> |
|||
# |
|||
# 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 orm, fields |
|||
from openerp.tools.translate import _ |
|||
import logging |
|||
|
|||
_logger = logging.getLogger(__name__) |
|||
|
|||
|
|||
class wizard_open_calling_partner(orm.TransientModel): |
|||
_name = "wizard.open.calling.partner" |
|||
_description = "Open calling partner" |
|||
|
|||
_columns = { |
|||
# I can't set any field to readonly, because otherwize it would call |
|||
# default_get (and thus connect to Asterisk) a second time when the user |
|||
# clicks on one of the buttons |
|||
'calling_number': fields.char('Calling number', size=30, help="Phone number of calling party that has been obtained from Asterisk."), |
|||
'partner_id': fields.many2one('res.partner', 'Partner name', help="Partner related to the calling number."), |
|||
'parent_partner_id': fields.many2one('res.partner', 'Parent partner', help="Parent Partner related to the calling number."), |
|||
'to_update_partner_id': fields.many2one('res.partner', 'Partner to update', help="Partner on which the phone or mobile number will be written"), |
|||
'current_phone': fields.related('to_update_partner_id', 'phone', type='char', relation='res.partner', string='Current phone'), |
|||
'current_mobile': fields.related('to_update_partner_id', 'mobile', type='char', relation='res.partner', string='Current mobile'), |
|||
} |
|||
|
|||
|
|||
def default_get(self, cr, uid, fields, context=None): |
|||
'''Thanks to the default_get method, we are able to query Asterisk and |
|||
get the corresponding partner when we launch the wizard''' |
|||
res = {} |
|||
if context is None: |
|||
context = {} |
|||
if 'incall_number_popup' in context: |
|||
# That's when we come from incall_notify_by_user_ids() |
|||
# of the module asterisk_popup() |
|||
res['partner_id'] = False |
|||
res['parent_partner_id'] = False |
|||
res['to_update_partner_id'] = False |
|||
res['calling_number'] = context.get('incall_number_popup') |
|||
else: |
|||
calling_number = self.pool['asterisk.server']._get_calling_number( |
|||
cr, uid, context=context) |
|||
#To test the code without Asterisk server |
|||
#calling_number = "0141981246" |
|||
if calling_number: |
|||
res['calling_number'] = calling_number |
|||
record = self.pool['phone.common'].get_record_from_phone_number( |
|||
cr, uid, calling_number, context=context) |
|||
if record and record[0] == 'res.partner': |
|||
res['partner_id'] = record[1] |
|||
partner = self.pool['res.partner'].browse( |
|||
cr, uid, record[1], context=context) |
|||
res['parent_partner_id'] = \ |
|||
partner.parent_id and partner.parent_id.id or False |
|||
else: |
|||
res['partner_id'] = False |
|||
res['parent_partner_id'] = False |
|||
res['to_update_partner_id'] = False |
|||
else: |
|||
_logger.debug("Could not get the calling number from Asterisk.") |
|||
raise orm.except_orm( |
|||
_('Error :'), |
|||
_("Could not get the calling number from Asterisk. Is your phone ringing or are you currently on the phone ? If yes, check your setup and look at the OpenERP debug logs.")) |
|||
|
|||
return res |
|||
|
|||
|
|||
def open_filtered_object( |
|||
self, cr, uid, ids, oerp_object, try_parent=True, context=None): |
|||
'''Returns the action that opens the list view of the 'oerp_object' |
|||
given as argument filtered on the partner''' |
|||
# This module only depends on "base" |
|||
# and I don't want to add a dependancy on "sale" or "account" |
|||
# So I just check here that the model exists, to avoid a crash |
|||
if not self.pool['ir.model'].search(cr, uid, [('model', '=', oerp_object._name)], context=context): |
|||
raise orm.except_orm(_('Error :'), _("The object '%s' is not found in your OpenERP database, probably because the related module is not installed." % oerp_object._description)) |
|||
|
|||
partner = self.read(cr, uid, ids[0], ['partner_id', 'parent_partner_id'], context=context) |
|||
if try_parent: |
|||
partner_id_to_filter = ( |
|||
partner['parent_partner_id'] |
|||
and partner['parent_partner_id'][0] |
|||
or (partner['partner_id'] and partner['partner_id'][0] or False)) |
|||
else: |
|||
partner_id_to_filter = partner['partner_id'] and partner['partner_id'][0] or False |
|||
if partner_id_to_filter: |
|||
action = { |
|||
'name': oerp_object._description, |
|||
'view_mode': 'tree,form,kanban', |
|||
'res_model': oerp_object._name, |
|||
'type': 'ir.actions.act_window', |
|||
'nodestroy': False, # close the pop-up wizard after action |
|||
'target': 'current', |
|||
'context': {'search_default_partner_id': partner_id_to_filter}, |
|||
} |
|||
return action |
|||
else: |
|||
return False |
|||
|
|||
|
|||
def open_sale_orders(self, cr, uid, ids, context=None): |
|||
'''Function called by the related button of the wizard''' |
|||
return self.open_filtered_object(cr, uid, ids, self.pool.get('sale.order'), context=context) |
|||
|
|||
|
|||
def open_invoices(self, cr, uid, ids, context=None): |
|||
'''Function called by the related button of the wizard''' |
|||
return self.open_filtered_object(cr, uid, ids, self.pool.get('account.invoice'), context=context) |
|||
|
|||
|
|||
def simple_open(self, cr, uid, ids, field='partner_id', context=None): |
|||
record_to_open = self.read(cr, uid, ids[0], [field], context=context)[field] |
|||
if record_to_open: |
|||
return { |
|||
'name': self.pool['res.partner']._description, |
|||
'view_mode': 'form,tree,kanban', |
|||
'res_model': 'res.partner', |
|||
'type': 'ir.actions.act_window', |
|||
'nodestroy': False, # close the pop-up wizard after action |
|||
'target': 'current', |
|||
'res_id': record_to_open[0], |
|||
} |
|||
else: |
|||
return False |
|||
|
|||
|
|||
def open_partner(self, cr, uid, ids, context=None): |
|||
'''Function called by the related button of the wizard''' |
|||
return self.simple_open(cr, uid, ids, field='partner_id', context=context) |
|||
|
|||
|
|||
# TODO |
|||
def open_parent_partner(self, cr, uid, ids, context=None): |
|||
'''Function called by the related button of the wizard''' |
|||
return self.simple_open(cr, uid, ids, field='parent_partner_id', context=context) |
|||
|
|||
|
|||
def create_partner(self, cr, uid, ids, phone_type='phone', context=None): |
|||
'''Function called by the related button of the wizard''' |
|||
calling_number = self.read(cr, uid, ids[0], ['calling_number'], context=context)['calling_number'] |
|||
ast_server = self.pool['asterisk.server']._get_asterisk_server_from_user(cr, uid, context=context) |
|||
# Convert the number to the international format |
|||
number_to_write = self.pool['asterisk.server']._convert_number_to_international_format(cr, uid, calling_number, ast_server, context=context) |
|||
|
|||
context['default_' + phone_type] = number_to_write |
|||
|
|||
action = { |
|||
'name': 'Create new partner', |
|||
'view_mode': 'form,tree,kanban', |
|||
'res_model': 'res.partner', |
|||
'type': 'ir.actions.act_window', |
|||
'nodestroy': False, |
|||
'target': 'current', |
|||
'context': context, |
|||
} |
|||
return action |
|||
|
|||
|
|||
def create_partner_phone(self, cr, uid, ids, context=None): |
|||
return self.create_partner(cr, uid, ids, phone_type='phone', context=context) |
|||
|
|||
|
|||
def create_partner_mobile(self, cr, uid, ids, context=None): |
|||
return self.create_partner(cr, uid, ids, phone_type='mobile', context=context) |
|||
|
|||
|
|||
def update_partner(self, cr, uid, ids, phone_type='mobile', context=None): |
|||
cur_wizard = self.browse(cr, uid, ids[0], context=context) |
|||
if not cur_wizard.to_update_partner_id: |
|||
raise orm.except_orm(_('Error :'), _("Select the partner to update.")) |
|||
ast_server = self.pool['asterisk.server']._get_asterisk_server_from_user(cr, uid, context=context) |
|||
number_to_write = self.pool['asterisk.server']._convert_number_to_international_format(cr, uid, cur_wizard.calling_number, ast_server, context=context) |
|||
self.pool['res.partner'].write(cr, uid, cur_wizard.to_update_partner_id.id, {phone_type: number_to_write}, context=context) |
|||
action = { |
|||
'name': 'Partner: ' + cur_wizard.to_update_partner_id.name, |
|||
'view_mode': 'form,tree,kanban', |
|||
'res_model': 'res.partner', |
|||
'type': 'ir.actions.act_window', |
|||
'nodestroy': False, |
|||
'target': 'current', |
|||
'res_id': cur_wizard.to_update_partner_id.id |
|||
} |
|||
return action |
|||
|
|||
|
|||
def update_partner_phone(self, cr, uid, ids, context=None): |
|||
return self.update_partner(cr, uid, ids, phone_type='phone', context=context) |
|||
|
|||
|
|||
def update_partner_mobile(self, cr, uid, ids, context=None): |
|||
return self.update_partner(cr, uid, ids, phone_type='mobile', context=context) |
|||
|
|||
|
|||
def onchange_to_update_partner(self, cr, uid, ids, to_update_partner_id, context=None): |
|||
res = {} |
|||
res['value'] = {} |
|||
if to_update_partner_id: |
|||
to_update_partner = self.pool['res.partner'].browse(cr, uid, to_update_partner_id, context=context) |
|||
res['value'].update({'current_phone': to_update_partner.phone, |
|||
'current_mobile': to_update_partner.mobile}) |
|||
else: |
|||
res['value'].update({'current_phone': False, 'current_mobile': False}) |
|||
return res |
|||
|
@ -1,51 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
Asterisk Click2dial module for OpenERP |
|||
Copyright (C) 2012-2013 Alexis de Lattre <alexis@via.ecp.fr> |
|||
The licence is in the file __openerp__.py |
|||
--> |
|||
|
|||
<openerp> |
|||
<data> |
|||
|
|||
<!-- Get partner from incoming phone call --> |
|||
<record id="view_open_calling_partner" model="ir.ui.view"> |
|||
<field name="name">view_open_calling_partner</field> |
|||
<field name="model">wizard.open.calling.partner</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Open calling partner" version="7.0"> |
|||
<group name="display_result"> |
|||
<field name="calling_number"/> |
|||
<field name="partner_id" attrs="{'invisible':[('partner_id','=',False)]}"/> |
|||
<field name="parent_partner_id" attrs="{'invisible':[('partner_id','=',False)]}" /> <!-- I want it visible when partner_id != False and partner_id = False, so that the user can see that this partner doesn't have a parent partner --> |
|||
</group> |
|||
<group attrs="{'invisible':[('partner_id','=',False)]}" name="partner_found"> |
|||
<button name="open_partner" icon="gtk-go-forward" string="Open Partner form" type="object" /> |
|||
<button name="open_parent_partner" icon="gtk-go-forward" string="Open Parent Partner form" type="object" attrs="{'invisible':[('parent_partner_id','=',False)]}"/> |
|||
<button name="open_sale_orders" icon="gtk-go-forward" string="Open Related Sale Orders" type="object" /> |
|||
<button name="open_invoices" icon="gtk-go-forward" string="Open Related Invoices" type="object" /> |
|||
</group> |
|||
<group attrs="{'invisible':[('partner_id','!=',False)]}" name="no_partner_found" colspan="4" col="8"> |
|||
<label string="No partner found in OpenERP with this number" colspan="8" /> |
|||
<separator string="Create a new partner" colspan="8" /> |
|||
<button name="create_partner_phone" icon="gtk-new" string="with calling number as phone" type="object" colspan="4"/> |
|||
<button name="create_partner_mobile" icon="gtk-new" string="with calling number as mobile" type="object" colspan="4"/> |
|||
<newline /> |
|||
|
|||
<separator string="Update an existing partner" colspan="8" /> |
|||
<field name="to_update_partner_id" colspan="8" on_change="onchange_to_update_partner(to_update_partner_id)"/> |
|||
<field name="current_phone" colspan="6"/> |
|||
<button name="update_partner_phone" icon="gtk-convert" string="Update phone" type="object" colspan="2"/> |
|||
<field name="current_mobile" colspan="6"/> |
|||
<button name="update_partner_mobile" icon="gtk-convert" string="Update mobile" type="object" colspan="2"/> |
|||
</group> |
|||
<footer> |
|||
<button special="cancel" string="Cancel" class="oe_link"/> |
|||
</footer> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
|
|||
</data> |
|||
</openerp> |
@ -1,24 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
Copyright (C) 2012-2013 Akretion (http://www.akretion.com) |
|||
@author: Alexis de Lattre <alexis.delattre@akretion.com> |
|||
The licence is in the file __openerp__.py |
|||
--> |
|||
|
|||
<openerp> |
|||
<data> |
|||
|
|||
<!-- Add button on the "Get partner from incoming phone call view" --> |
|||
<record id="asterisk_click2dial_crm_open_calling_partner_view" model="ir.ui.view"> |
|||
<field name="name">asterisk_click2dial_crm.open_calling_partner.view</field> |
|||
<field name="model">wizard.open.calling.partner</field> |
|||
<field name="inherit_id" ref="asterisk_click2dial.view_open_calling_partner"/> |
|||
<field name="arch" type="xml"> |
|||
<group name="partner_found" position="inside"> |
|||
<button name="create_incoming_phonecall" string="Create Call in CRM" type="object" icon="gtk-new" /> |
|||
</group> |
|||
</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
@ -1,46 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Asterisk click2dial CRM Claim module for OpenERP |
|||
# Copyright (c) 2012-2013 Akretion (http://www.akretion.com) |
|||
# Copyright (C) 2013 Invitu <contact@invitu.com> |
|||
# @author Alexis de Lattre <alexis.delattre@akretion.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/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
{ |
|||
"name": "Asterisk Click2dial CRM Claim", |
|||
"version": "0.1", |
|||
"author": "Akretion", |
|||
"website": "http://www.akretion.com", |
|||
"license" : "AGPL-3", |
|||
"category": "Phone", |
|||
"description": """ |
|||
This module adds a button "Open Related CRM Claims" on the "Open calling partner" wizard and a "Dial" button on the CRM Claim form. |
|||
|
|||
A detailed documentation for the OpenERP-Asterisk connector is available on the Akretion Web site : http://www.akretion.com/open-source-contributions/openerp-asterisk-voip-connector |
|||
""", |
|||
"depends": [ |
|||
'asterisk_click2dial', |
|||
'crm_claim_phone', |
|||
], |
|||
"demo": [], |
|||
"data": [ |
|||
'wizard/open_calling_partner_view.xml', |
|||
], |
|||
"installable": True, |
|||
"application": True, |
|||
} |
@ -1,23 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Asterisk Click2Dial CRM Claim module for OpenERP |
|||
# Copyright (C) 2012-2013 Akretion (http://www.akretion.com/) |
|||
# @author Alexis de Lattre <alexis.delattre@akretion.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 . import open_calling_partner |
@ -1,32 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Asterisk Click2dial CRM Claim module for OpenERP |
|||
# Copyright (C) 2012-2014 Akretion (http://www.akretion.com/) |
|||
# @author Alexis de Lattre <alexis.delattre@akretion.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 orm |
|||
|
|||
|
|||
class wizard_open_calling_partner(orm.TransientModel): |
|||
_inherit = "wizard.open.calling.partner" |
|||
|
|||
def open_crm_claims(self, cr, uid, ids, context=None): |
|||
'''Function called by the related button of the wizard''' |
|||
return self.open_filtered_object( |
|||
cr, uid, ids, self.pool['crm.claim'], context=context) |
@ -1,24 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
Copyright (C) 2012-2013 Akretion (http://www.akretion.com) |
|||
@author Alexis de Lattre <alexis.delattre@akretion.com> |
|||
The licence is in the file __openerp__.py |
|||
--> |
|||
|
|||
<openerp> |
|||
<data> |
|||
|
|||
<!-- Add button on the "Open Calling partner" wizard --> |
|||
<record id="add_open_crm_claims_button" model="ir.ui.view"> |
|||
<field name="name">asterisk_click2dial_crm_claim.add_open_crm_claims_button</field> |
|||
<field name="model">wizard.open.calling.partner</field> |
|||
<field name="inherit_id" ref="asterisk_click2dial.view_open_calling_partner"/> |
|||
<field name="arch" type="xml"> |
|||
<group name="partner_found" position="inside"> |
|||
<button name="open_crm_claims" string="Open Related CRM Claims" type="object" icon="gtk-go-forward" /> |
|||
</group> |
|||
</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
@ -1,43 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Asterisk click2dial Registration 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/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
{ |
|||
"name": "Asterisk Click2dial Registration", |
|||
"version": "0.1", |
|||
"author": "INVITU", |
|||
"website": "http://www.invitu.com", |
|||
"license": "AGPL-3", |
|||
"category": "Phone", |
|||
"description": """ |
|||
This module adds a button "Open Registrations" on the "Open calling partner" wizard and a "Dial" button on the Registration form. |
|||
|
|||
A detailed documentation for the OpenERP-Asterisk connector is available on the Akretion Web site : http://www.akretion.com/open-source-contributions/openerp-asterisk-voip-connector |
|||
""", |
|||
"depends": [ |
|||
'asterisk_click2dial', |
|||
'event_phone', |
|||
], |
|||
"data": [ |
|||
'wizard/open_calling_partner_view.xml', |
|||
], |
|||
"installable": True, |
|||
"application": True, |
|||
} |
@ -1,22 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Asterisk Click2Dial Registration module for OpenERP |
|||
# Copyright (C) 2013 Invitu (http://www.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 . import open_calling_partner |
@ -1,31 +0,0 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Asterisk Click2dial Registration module for OpenERP |
|||
# Copyright (C) 2013 Invitu (http://www.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 orm |
|||
|
|||
|
|||
class wizard_open_calling_partner(orm.TransientModel): |
|||
_inherit = "wizard.open.calling.partner" |
|||
|
|||
def open_registrations(self, cr, uid, ids, context=None): |
|||
'''Function called by the related button of the wizard''' |
|||
return self.open_filtered_object( |
|||
cr, uid, ids, self.pool['event.registration'], context=context) |
@ -1,23 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
Copyright (C) 2013 Invitu (http://www.invitu.com) |
|||
The licence is in the file __openerp__.py |
|||
--> |
|||
|
|||
<openerp> |
|||
<data> |
|||
|
|||
<!-- Add button on the "Open Calling partner" wizard --> |
|||
<record id="add_open_registrations_button" model="ir.ui.view"> |
|||
<field name="name">asterisk_click2dial_registration.add_open_registrations_button</field> |
|||
<field name="model">wizard.open.calling.partner</field> |
|||
<field name="inherit_id" ref="asterisk_click2dial.view_open_calling_partner"/> |
|||
<field name="arch" type="xml"> |
|||
<group name="partner_found" position="inside"> |
|||
<button name="open_registrations" string="Open Related Registrations" type="object" icon="gtk-go-forward" /> |
|||
</group> |
|||
</field> |
|||
</record> |
|||
|
|||
</data> |
|||
</openerp> |
@ -0,0 +1,130 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Asterisk Click2dial module for OpenERP |
|||
# Copyright (C) 2010-2013 Alexis de Lattre <alexis@via.ecp.fr> |
|||
# |
|||
# 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 orm, fields |
|||
from openerp.tools.translate import _ |
|||
import logging |
|||
import phonenumbers |
|||
|
|||
_logger = logging.getLogger(__name__) |
|||
|
|||
|
|||
class number_not_found(orm.TransientModel): |
|||
_name = "number.not.found" |
|||
_description = "Number not found" |
|||
|
|||
_columns = { |
|||
'calling_number': fields.char( |
|||
'Calling Number', size=64, readonly=True, |
|||
help="Phone number of calling party that has been obtained " |
|||
"from Asterisk, in the format used by Asterisk (not E.164)."), |
|||
'e164_number': fields.char( |
|||
'E.164 Number', size=64, |
|||
help="E.164 equivalent of the calling number."), |
|||
'number_type': fields.selection( |
|||
[('phone', 'Fixed'), ('mobile', 'Mobile')], |
|||
'Fixed/Mobile', required=True), |
|||
'to_update_partner_id': fields.many2one( |
|||
'res.partner', 'Partner to Update', |
|||
help="Partner on which the phone number will be written"), |
|||
'current_partner_phone': fields.related( |
|||
'to_update_partner_id', 'phone', type='char', |
|||
relation='res.partner', string='Current Phone', readonly=True), |
|||
'current_partner_mobile': fields.related( |
|||
'to_update_partner_id', 'mobile', type='char', |
|||
relation='res.partner', string='Current Mobile', readonly=True), |
|||
} |
|||
|
|||
def default_get(self, cr, uid, fields_list, context=None): |
|||
res = super(number_not_found, self).default_get( |
|||
cr, uid, fields_list, context=context) |
|||
if not res: |
|||
res = {} |
|||
if res.get('calling_number'): |
|||
convert = self.pool['phone.common']._generic_reformat_phonenumbers( |
|||
cr, uid, {'phone': res.get('calling_number')}, context=context) |
|||
parsed_num = phonenumbers.parse(convert.get('phone')) |
|||
res['e164_number'] = phonenumbers.format_number( |
|||
parsed_num, phonenumbers.PhoneNumberFormat.INTERNATIONAL) |
|||
number_type = phonenumbers.number_type(parsed_num) |
|||
if number_type == 1: |
|||
res['number_type'] = 'mobile' |
|||
else: |
|||
res['number_type'] = 'phone' |
|||
return res |
|||
|
|||
def create_partner(self, cr, uid, ids, context=None): |
|||
'''Function called by the related button of the wizard''' |
|||
if context is None: |
|||
context = {} |
|||
wiz = self.browse(cr, uid, ids[0], context=context) |
|||
parsed_num = phonenumbers.parse(wiz.e164_number, None) |
|||
number_type = phonenumbers.number_type(parsed_num) |
|||
|
|||
context['default_%s' % wiz.number_type] = wiz.e164_number |
|||
action = { |
|||
'name': _('Create New Partner'), |
|||
'view_mode': 'form,tree,kanban', |
|||
'res_model': 'res.partner', |
|||
'type': 'ir.actions.act_window', |
|||
'nodestroy': False, |
|||
'target': 'current', |
|||
'context': context, |
|||
} |
|||
return action |
|||
|
|||
def update_partner(self, cr, uid, ids, context=None): |
|||
wiz = self.browse(cr, uid, ids[0], context=context) |
|||
if not wiz.to_update_partner_id: |
|||
raise orm.except_orm( |
|||
_('Error:'), |
|||
_("Select the Partner to Update.")) |
|||
self.pool['res.partner'].write( |
|||
cr, uid, wiz.to_update_partner_id.id, |
|||
{wiz.number_type: wiz.e164_number}, context=context) |
|||
action = { |
|||
'name': _('Partner: %s' % wiz.to_update_partner_id.name), |
|||
'type': 'ir.actions.act_window', |
|||
'res_model': 'res.partner', |
|||
'view_mode': 'form,tree,kanban', |
|||
'nodestroy': False, |
|||
'target': 'current', |
|||
'res_id': wiz.to_update_partner_id.id, |
|||
'context': context, |
|||
} |
|||
return action |
|||
|
|||
def onchange_to_update_partner( |
|||
self, cr, uid, ids, to_update_partner_id, context=None): |
|||
res = {'value': {}} |
|||
if to_update_partner_id: |
|||
to_update_partner = self.pool['res.partner'].browse( |
|||
cr, uid, to_update_partner_id, context=context) |
|||
res['value'].update({ |
|||
'current_partner_phone': to_update_partner.phone, |
|||
'current_partner_mobile': to_update_partner.mobile, |
|||
}) |
|||
else: |
|||
res['value'].update({ |
|||
'current_partner_phone': False, |
|||
'current_partner_mobile': False, |
|||
}) |
|||
return res |
@ -0,0 +1,55 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
Asterisk Click2dial module for OpenERP |
|||
Copyright (C) 2012-2013 Alexis de Lattre <alexis@via.ecp.fr> |
|||
The licence is in the file __openerp__.py |
|||
--> |
|||
|
|||
<openerp> |
|||
<data> |
|||
|
|||
<record id="number_not_found_form" model="ir.ui.view"> |
|||
<field name="name">number.not.found.form</field> |
|||
<field name="model">number.not.found</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Number Not Found" version="7.0"> |
|||
<div class="oe_title"> |
|||
<label string="Number not found:" for="calling_number"/> |
|||
<h1> |
|||
<field name="calling_number" /> |
|||
</h1> |
|||
<label string="Number converted to international format:" |
|||
for="e164_number"/> |
|||
<h2> |
|||
<field name="e164_number" /> |
|||
</h2> |
|||
<label for="number_type"/> |
|||
<h3> |
|||
<field name="number_type"/> |
|||
</h3> |
|||
</div> |
|||
<group colspan="4" col="2" name="create-update"> |
|||
<group name="partner" string="Create or Update a Partner" |
|||
colspan="1" col="2"> |
|||
<button name="create_partner" icon="gtk-new" colspan="2" |
|||
string="Create Partner with this Number" type="object"/> |
|||
<field name="to_update_partner_id" |
|||
on_change="onchange_to_update_partner(to_update_partner_id)"/> |
|||
<field name="current_partner_phone" widget="phone" |
|||
options="{'dial_button_invisible': True}"/> |
|||
<field name="current_partner_mobile" widget="phone" |
|||
options="{'dial_button_invisible': True}"/> |
|||
<button name="update_partner" icon="gtk-convert" colspan="2" |
|||
string="Update Partner with this Number" type="object"/> |
|||
</group> |
|||
</group> |
|||
<footer> |
|||
<button special="cancel" string="Close" class="oe_link"/> |
|||
</footer> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
|
|||
</data> |
|||
</openerp> |
@ -1,36 +1,38 @@ |
|||
# Translation of OpenERP Server. |
|||
# This file contains the translation of the following modules: |
|||
# * asterisk_popup |
|||
# * base_phone_popup |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: OpenERP Server 7.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2014-01-31 23:35+0000\n" |
|||
"PO-Revision-Date: 2014-01-31 23:35+0000\n" |
|||
"Last-Translator: <>\n" |
|||
"POT-Creation-Date: 2014-08-25 22:05+0000\n" |
|||
"PO-Revision-Date: 2014-08-25 22:05+0000\n" |
|||
"Last-Translator: Alexis de Lattre <alexis.delattre@akretion.com>\n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Plural-Forms: \n" |
|||
|
|||
#. module: asterisk_popup |
|||
#: model:ir.model,name:asterisk_popup.model_res_partner |
|||
msgid "Partner" |
|||
msgstr "Partenaire" |
|||
#. module: base_phone_popup |
|||
#: code:addons/base_phone_popup/popup.py:49 |
|||
#, python-format |
|||
msgid "Number Not Found" |
|||
msgstr "Numéro introuvable" |
|||
|
|||
#. module: asterisk_popup |
|||
#. module: base_phone_popup |
|||
#: field:res.users,context_incall_popup:0 |
|||
msgid "Pop-up on Incoming Calls" |
|||
msgstr "Pop-up sur Appel Entrant" |
|||
|
|||
#. module: asterisk_popup |
|||
#: model:ir.model,name:asterisk_popup.model_res_users |
|||
#. module: base_phone_popup |
|||
#: model:ir.model,name:base_phone_popup.model_res_users |
|||
msgid "Users" |
|||
msgstr "Utilisateurs" |
|||
|
|||
#. module: asterisk_popup |
|||
#: view:res.users:0 |
|||
msgid "Telephony Preferences" |
|||
msgstr "Préférences téléphoniques" |
|||
#. module: base_phone_popup |
|||
#: model:ir.model,name:base_phone_popup.model_phone_common |
|||
msgid "phone.common" |
|||
msgstr "phone.common" |
|||
|
@ -0,0 +1,112 @@ |
|||
# Translation of OpenERP Server. |
|||
# This file contains the translation of the following modules: |
|||
# * crm_phone |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: OpenERP Server 7.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2014-08-25 21:38+0000\n" |
|||
"PO-Revision-Date: 2014-08-25 21:38+0000\n" |
|||
"Last-Translator: <>\n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Plural-Forms: \n" |
|||
|
|||
#. module: crm_phone |
|||
#: view:number.not.found:0 |
|||
msgid "Create Lead with this Number" |
|||
msgstr "" |
|||
|
|||
#. module: crm_phone |
|||
#: code:addons/crm_phone/wizard/number_not_found.py:50 |
|||
#, python-format |
|||
msgid "Create New Lead" |
|||
msgstr "" |
|||
|
|||
#. module: crm_phone |
|||
#: view:number.not.found:0 |
|||
msgid "Create or Update a Lead" |
|||
msgstr "" |
|||
|
|||
#. module: crm_phone |
|||
#: field:number.not.found,current_lead_mobile:0 |
|||
msgid "Current Mobile" |
|||
msgstr "" |
|||
|
|||
#. module: crm_phone |
|||
#: field:number.not.found,current_lead_phone:0 |
|||
msgid "Current Phone" |
|||
msgstr "" |
|||
|
|||
#. module: crm_phone |
|||
#: code:addons/crm_phone/wizard/number_not_found.py:70 |
|||
#, python-format |
|||
msgid "Error:" |
|||
msgstr "" |
|||
|
|||
#. module: crm_phone |
|||
#: help:number.not.found,to_update_lead_id:0 |
|||
msgid "Lead on which the phone number will be written" |
|||
msgstr "" |
|||
|
|||
#. module: crm_phone |
|||
#: field:number.not.found,to_update_lead_id:0 |
|||
msgid "Lead to Update" |
|||
msgstr "" |
|||
|
|||
#. module: crm_phone |
|||
#: model:ir.model,name:crm_phone.model_crm_lead |
|||
msgid "Lead/Opportunity" |
|||
msgstr "" |
|||
|
|||
#. module: crm_phone |
|||
#: code:addons/crm_phone/wizard/number_not_found.py:76 |
|||
#, python-format |
|||
msgid "Lead: %s" |
|||
msgstr "" |
|||
|
|||
#. module: crm_phone |
|||
#: model:ir.model,name:crm_phone.model_number_not_found |
|||
msgid "Number not found" |
|||
msgstr "" |
|||
|
|||
#. module: crm_phone |
|||
#: model:ir.model,name:crm_phone.model_crm_phonecall |
|||
msgid "Phonecall" |
|||
msgstr "" |
|||
|
|||
#. module: crm_phone |
|||
#: code:addons/crm_phone/wizard/number_not_found.py:71 |
|||
#, python-format |
|||
msgid "Select the Lead to Update." |
|||
msgstr "" |
|||
|
|||
#. module: crm_phone |
|||
#: sql_constraint:crm.lead:0 |
|||
msgid "The probability of closing the deal should be between 0% and 100%!" |
|||
msgstr "" |
|||
|
|||
#. module: crm_phone |
|||
#: view:number.not.found:0 |
|||
msgid "Update Lead with this Number" |
|||
msgstr "" |
|||
|
|||
#. module: crm_phone |
|||
#: view:crm.lead:0 |
|||
msgid "fax" |
|||
msgstr "" |
|||
|
|||
#. module: crm_phone |
|||
#: view:crm.lead:0 |
|||
#: view:crm.phonecall:0 |
|||
msgid "phone" |
|||
msgstr "" |
|||
|
|||
#. module: crm_phone |
|||
#: model:ir.model,name:crm_phone.model_phone_common |
|||
msgid "phone.common" |
|||
msgstr "" |
|||
|
@ -0,0 +1,112 @@ |
|||
# Translation of OpenERP Server. |
|||
# This file contains the translation of the following modules: |
|||
# * crm_phone |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: OpenERP Server 7.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2014-08-25 21:39+0000\n" |
|||
"PO-Revision-Date: 2014-08-25 21:39+0000\n" |
|||
"Last-Translator: Alexis de Lattre <alexis.delattre@akretion.com>\n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Plural-Forms: \n" |
|||
|
|||
#. module: crm_phone |
|||
#: view:number.not.found:0 |
|||
msgid "Create Lead with this Number" |
|||
msgstr "Créer une piste avec ce numéro" |
|||
|
|||
#. module: crm_phone |
|||
#: code:addons/crm_phone/wizard/number_not_found.py:50 |
|||
#, python-format |
|||
msgid "Create New Lead" |
|||
msgstr "Créer une nouvelle piste" |
|||
|
|||
#. module: crm_phone |
|||
#: view:number.not.found:0 |
|||
msgid "Create or Update a Lead" |
|||
msgstr "Créer ou mettre à jour une piste" |
|||
|
|||
#. module: crm_phone |
|||
#: field:number.not.found,current_lead_mobile:0 |
|||
msgid "Current Mobile" |
|||
msgstr "Portable actuel" |
|||
|
|||
#. module: crm_phone |
|||
#: field:number.not.found,current_lead_phone:0 |
|||
msgid "Current Phone" |
|||
msgstr "Téléphone actuel" |
|||
|
|||
#. module: crm_phone |
|||
#: code:addons/crm_phone/wizard/number_not_found.py:70 |
|||
#, python-format |
|||
msgid "Error:" |
|||
msgstr "Erreur :" |
|||
|
|||
#. module: crm_phone |
|||
#: help:number.not.found,to_update_lead_id:0 |
|||
msgid "Lead on which the phone number will be written" |
|||
msgstr "Piste sur laquelle le numéro de téléphone sera écrit" |
|||
|
|||
#. module: crm_phone |
|||
#: field:number.not.found,to_update_lead_id:0 |
|||
msgid "Lead to Update" |
|||
msgstr "Piste à mettre à jour" |
|||
|
|||
#. module: crm_phone |
|||
#: model:ir.model,name:crm_phone.model_crm_lead |
|||
msgid "Lead/Opportunity" |
|||
msgstr "Piste/opportunité" |
|||
|
|||
#. module: crm_phone |
|||
#: code:addons/crm_phone/wizard/number_not_found.py:76 |
|||
#, python-format |
|||
msgid "Lead: %s" |
|||
msgstr "Piste : %s" |
|||
|
|||
#. module: crm_phone |
|||
#: model:ir.model,name:crm_phone.model_number_not_found |
|||
msgid "Number not found" |
|||
msgstr "Numéro introuvable" |
|||
|
|||
#. module: crm_phone |
|||
#: model:ir.model,name:crm_phone.model_crm_phonecall |
|||
msgid "Phonecall" |
|||
msgstr "Appel téléphonique" |
|||
|
|||
#. module: crm_phone |
|||
#: code:addons/crm_phone/wizard/number_not_found.py:71 |
|||
#, python-format |
|||
msgid "Select the Lead to Update." |
|||
msgstr "Sélectionnez la piste à mettre à jour." |
|||
|
|||
#. module: crm_phone |
|||
#: sql_constraint:crm.lead:0 |
|||
msgid "The probability of closing the deal should be between 0% and 100%!" |
|||
msgstr "La probabilité de gagner l'affaire doit être comprise entre 0% et 100% !" |
|||
|
|||
#. module: crm_phone |
|||
#: view:number.not.found:0 |
|||
msgid "Update Lead with this Number" |
|||
msgstr "Mettre à jour la piste avec ce numéro" |
|||
|
|||
#. module: crm_phone |
|||
#: view:crm.lead:0 |
|||
msgid "fax" |
|||
msgstr "fax" |
|||
|
|||
#. module: crm_phone |
|||
#: view:crm.lead:0 |
|||
#: view:crm.phonecall:0 |
|||
msgid "phone" |
|||
msgstr "phone" |
|||
|
|||
#. module: crm_phone |
|||
#: model:ir.model,name:crm_phone.model_phone_common |
|||
msgid "phone.common" |
|||
msgstr "phone.common" |
|||
|
@ -0,0 +1,105 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Asterisk Click2dial module for OpenERP |
|||
# Copyright (C) 2010-2013 Alexis de Lattre <alexis@via.ecp.fr> |
|||
# |
|||
# 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 orm, fields |
|||
from openerp.tools.translate import _ |
|||
import phonenumbers |
|||
|
|||
|
|||
class number_not_found(orm.TransientModel): |
|||
_inherit = "number.not.found" |
|||
|
|||
_columns = { |
|||
'to_update_lead_id': fields.many2one( |
|||
'crm.lead', 'Lead to Update', |
|||
domain=[('type', '=', 'lead')], |
|||
help="Lead on which the phone number will be written"), |
|||
'current_lead_phone': fields.related( |
|||
'to_update_lead_id', 'phone', type='char', |
|||
relation='crm.lead', string='Current Phone', readonly=True), |
|||
'current_lead_mobile': fields.related( |
|||
'to_update_lead_id', 'mobile', type='char', |
|||
relation='crm.lead', string='Current Mobile', readonly=True), |
|||
} |
|||
|
|||
def create_lead(self, cr, uid, ids, context=None): |
|||
'''Function called by the related button of the wizard''' |
|||
if context is None: |
|||
context = {} |
|||
wiz = self.browse(cr, uid, ids[0], context=context) |
|||
|
|||
action = { |
|||
'name': _('Create New Lead'), |
|||
'type': 'ir.actions.act_window', |
|||
'res_model': 'crm.lead', |
|||
'view_mode': 'form,tree', |
|||
'domain': ['|', ('type', '=', 'lead'), ('type', '=', False)], |
|||
'nodestroy': False, |
|||
'target': 'current', |
|||
'context': { |
|||
'default_%s' % wiz.number_type: wiz.e164_number, |
|||
'default_type': 'lead', |
|||
'stage_type': 'lead', |
|||
'needaction_menu_ref': 'crm.menu_crm_opportunities', |
|||
}, |
|||
} |
|||
return action |
|||
|
|||
def update_lead(self, cr, uid, ids, context=None): |
|||
wiz = self.browse(cr, uid, ids[0], context=context) |
|||
if not wiz.to_update_lead_id: |
|||
raise orm.except_orm( |
|||
_('Error:'), |
|||
_("Select the Lead to Update.")) |
|||
self.pool['crm.lead'].write( |
|||
cr, uid, wiz.to_update_lead_id.id, |
|||
{wiz.number_type: wiz.e164_number}, context=context) |
|||
action = { |
|||
'name': _('Lead: %s' % wiz.to_update_lead_id.name), |
|||
'type': 'ir.actions.act_window', |
|||
'res_model': 'crm.lead', |
|||
'view_mode': 'form,tree', |
|||
'nodestroy': False, |
|||
'target': 'current', |
|||
'res_id': wiz.to_update_lead_id.id, |
|||
'context': { |
|||
'stage_type': 'lead', |
|||
'needaction_menu_ref': 'crm.menu_crm_opportunities', |
|||
}, |
|||
} |
|||
return action |
|||
|
|||
def onchange_to_update_lead( |
|||
self, cr, uid, ids, to_update_lead_id, context=None): |
|||
res = {'value': {}} |
|||
if to_update_lead_id: |
|||
to_update_lead = self.pool['crm.lead'].browse( |
|||
cr, uid, to_update_lead_id, context=context) |
|||
res['value'].update({ |
|||
'current_lead_phone': to_update_lead.phone, |
|||
'current_lead_mobile': to_update_lead.mobile, |
|||
}) |
|||
else: |
|||
res['value'].update({ |
|||
'current_lead_phone': False, |
|||
'current_lead_mobile': False, |
|||
}) |
|||
return res |
@ -0,0 +1,36 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!-- |
|||
CRM Phone module for OpenERP |
|||
Copyright (C) 2014 Alexis de Lattre <alexis@via.ecp.fr> |
|||
The licence is in the file __openerp__.py |
|||
--> |
|||
|
|||
<openerp> |
|||
<data> |
|||
|
|||
<record id="number_not_found_form" model="ir.ui.view"> |
|||
<field name="name">crm_phone.number.not.found.form</field> |
|||
<field name="model">number.not.found</field> |
|||
<field name="inherit_id" ref="base_phone.number_not_found_form"/> |
|||
<field name="arch" type="xml"> |
|||
<group name="create-update" position="inside"> |
|||
<group name="lead" string="Create or Update a Lead" |
|||
colspan="1" col="2"> |
|||
<button name="create_lead" icon="gtk-new" colspan="2" |
|||
string="Create Lead with this Number" type="object"/> |
|||
<field name="to_update_lead_id" |
|||
on_change="onchange_to_update_lead(to_update_lead_id)"/> |
|||
<field name="current_lead_phone" widget="phone" |
|||
options="{'dial_button_invisible': True}"/> |
|||
<field name="current_lead_mobile" widget="phone" |
|||
options="{'dial_button_invisible': True}"/> |
|||
<button name="update_lead" icon="gtk-convert" colspan="2" |
|||
string="Update Lead with this Number" type="object"/> |
|||
</group> |
|||
</group> |
|||
</field> |
|||
</record> |
|||
|
|||
|
|||
</data> |
|||
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue