Browse Source

- Add copyright headers in XML files

- Convert the comments for the functions to the standard style
6.0
Alexis de Lattre 14 years ago
parent
commit
9f9d8a6021
  1. 25
      asterisk_click2dial/asterisk_click2dial.py
  2. 8
      asterisk_click2dial/asterisk_click2dial_demo.xml
  3. 10
      asterisk_click2dial/asterisk_server_view.xml
  4. 2
      asterisk_click2dial/i18n/fr_FR.po
  5. 9
      asterisk_click2dial/res_partner_view.xml
  6. 8
      asterisk_click2dial/res_users_view.xml
  7. 7
      asterisk_click2dial/security/asterisk_server_security.xml

25
asterisk_click2dial/asterisk_click2dial.py

@ -115,12 +115,15 @@ class asterisk_server(osv.osv):
] ]
# This function is dedicated to the transformation of the number
# available in OpenERP to the number that Asterisk should dial.
# You may have to inherit this function in another module specific
# for your company if you are not happy with the way I reformat
# the OpenERP numbers.
def reformat_number(self, cr, uid, ids, erp_number, ast_server, context): def reformat_number(self, cr, uid, ids, erp_number, ast_server, context):
'''
This function is dedicated to the transformation of the number
available in OpenERP to the number that Asterisk should dial.
You may have to inherit this function in another module specific
for your company if you are not happy with the way I reformat
the OpenERP numbers.
'''
logger = netsvc.Logger() logger = netsvc.Logger()
error_title_msg = _("Invalid phone number") error_title_msg = _("Invalid phone number")
invalid_international_format_msg = _("The phone number is not written in valid international format. Example of valid international format : +33 1 41 98 12 42") invalid_international_format_msg = _("The phone number is not written in valid international format. Example of valid international format : +33 1 41 98 12 42")
@ -184,9 +187,12 @@ class asterisk_server(osv.osv):
logger.notifyChannel('asterisk_click2dial', netsvc.LOG_DEBUG, 'Out prefix = ' + out_prefix + ' - Number to be sent to Asterisk = ' + tmp_number) logger.notifyChannel('asterisk_click2dial', netsvc.LOG_DEBUG, 'Out prefix = ' + out_prefix + ' - Number to be sent to Asterisk = ' + tmp_number)
return tmp_number return tmp_number
# Open the socket to the Asterisk Manager Interface
# and send instructions to Dial to Asterisk
def dial(self, cr, uid, ids, erp_number, context): def dial(self, cr, uid, ids, erp_number, context):
'''
Open the socket to the Asterisk Manager Interface (AMI)
and send instructions to Dial to Asterisk. That's the important function !
'''
logger = netsvc.Logger() logger = netsvc.Logger()
user = self.pool.get('res.users').browse(cr, uid, uid, context=context) user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
@ -269,12 +275,15 @@ class res_partner_address(osv.osv):
_name = "res.partner.address" _name = "res.partner.address"
_inherit ="res.partner.address" _inherit ="res.partner.address"
# Functions called by the button "Dial" in the partner address view
def action_dial_phone(self, cr, uid, ids, context): def action_dial_phone(self, cr, uid, ids, context):
'''Function called by the button 'Dial' next to the 'phone' field
in the partner address view'''
erp_number = self.read(cr, uid, ids, ['phone'], context=context)[0]['phone'] erp_number = self.read(cr, uid, ids, ['phone'], context=context)[0]['phone']
self.pool.get('asterisk.server').dial(cr, uid, ids, erp_number, context) self.pool.get('asterisk.server').dial(cr, uid, ids, erp_number, context)
def action_dial_mobile(self, cr, uid, ids, context): def action_dial_mobile(self, cr, uid, ids, context):
'''Function called by the button 'Dial' next to the 'mobile' field
in the partner address view'''
erp_number = self.read(cr, uid, ids, ['mobile'], context=context)[0]['mobile'] erp_number = self.read(cr, uid, ids, ['mobile'], context=context)[0]['mobile']
self.pool.get('asterisk.server').dial(cr, uid, ids, erp_number, context) self.pool.get('asterisk.server').dial(cr, uid, ids, erp_number, context)

8
asterisk_click2dial/asterisk_click2dial_demo.xml

@ -1,4 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!--
Asterisk Click2dial module for OpenERP
Copyright (C) 2010 Alexis de Lattre <alexis@via.ecp.fr>
The licence is in the file __terp__.py
Demo data for the click2dial module
-->
<openerp> <openerp>
<data noupdate="1"> <data noupdate="1">
<record id="demo_ast_server" model="asterisk.server"> <record id="demo_ast_server" model="asterisk.server">

10
asterisk_click2dial/asterisk_server_view.xml

@ -1,7 +1,14 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!--
Asterisk Click2dial module for OpenERP
Copyright (C) 2010 Alexis de Lattre <alexis@via.ecp.fr>
The licence is in the file __terp__.py
-->
<openerp> <openerp>
<data> <data>
<!-- Inherit res.company to add tab for Asterisk servers -->
<record id="view_asterisk_server_company_form" model="ir.ui.view"> <record id="view_asterisk_server_company_form" model="ir.ui.view">
<field name="name">asterisk.server.company</field> <field name="name">asterisk.server.company</field>
<field name="model">res.company</field> <field name="model">res.company</field>
@ -16,6 +23,7 @@
</field> </field>
</record> </record>
<!-- Form view for asterisk.server -->
<record id="view_asterisk_server_form" model="ir.ui.view"> <record id="view_asterisk_server_form" model="ir.ui.view">
<field name="name">asterisk.server.form</field> <field name="name">asterisk.server.form</field>
<field name="model">asterisk.server</field> <field name="model">asterisk.server</field>
@ -40,6 +48,7 @@
</field> </field>
</record> </record>
<!-- Tree view for asterisk.server -->
<record id="view_asterisk_server_tree" model="ir.ui.view"> <record id="view_asterisk_server_tree" model="ir.ui.view">
<field name="name">asterisk.server.tree</field> <field name="name">asterisk.server.tree</field>
<field name="model">asterisk.server</field> <field name="model">asterisk.server</field>
@ -54,6 +63,7 @@
</field> </field>
</record> </record>
<!-- Action for asterisk.server -->
<record id="action_asterisk_server" model="ir.actions.act_window"> <record id="action_asterisk_server" model="ir.actions.act_window">
<field name="name">Asterisk Servers</field> <field name="name">Asterisk Servers</field>
<field name="res_model">asterisk.server</field> <field name="res_model">asterisk.server</field>

2
asterisk_click2dial/i18n/fr_FR.po

@ -8,7 +8,7 @@ msgstr ""
"Report-Msgid-Bugs-To: support@openerp.com\n" "Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2010-09-10 20:15:08+0000\n" "POT-Creation-Date: 2010-09-10 20:15:08+0000\n"
"PO-Revision-Date: 2010-09-10 20:15:08+0000\n" "PO-Revision-Date: 2010-09-10 20:15:08+0000\n"
"Last-Translator: <>\n"
"Last-Translator: Alexis de Lattre <alexis@via.ecp.fr>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"

9
asterisk_click2dial/res_partner_view.xml

@ -1,4 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!--
Asterisk Click2dial module for OpenERP
Copyright (C) 2010 Alexis de Lattre <alexis@via.ecp.fr>
The licence is in the file __terp__.py
Inherit partner_address views to add 'Dial' button next to 'phone'
and 'mobile' fields
-->
<openerp> <openerp>
<data> <data>

8
asterisk_click2dial/res_users_view.xml

@ -1,4 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!--
Asterisk Click2dial module for OpenERP
Copyright (C) 2010 Alexis de Lattre <alexis@via.ecp.fr>
The licence is in the file __terp__.py
Inherit res_users view to add the click2dial-related fields
-->
<openerp> <openerp>
<data> <data>

7
asterisk_click2dial/security/asterisk_server_security.xml

@ -1,4 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!--
Asterisk Click2dial module for OpenERP
Copyright (C) 2010 Alexis de Lattre <alexis@via.ecp.fr>
The licence is in the file __terp__.py
Default access rules for the new asterisk.server object
-->
<openerp> <openerp>
<data noupdate="1"> <data noupdate="1">

Loading…
Cancel
Save