Browse Source

Country_prefix is now a "required" field.

Added "active" field on asterisk.server object.
In order to access all the Asterisk servers, included the desactivated ones,
I added a view dedicated to the object asterisk.server, which is accessible
under Administration > Configuration.
6.0
Alexis de Lattre 14 years ago
parent
commit
dde1a23510
  1. 4
      asterisk_click2dial/asterisk_click2dial.py
  2. 80
      asterisk_click2dial/asterisk_server_view.xml

4
asterisk_click2dial/asterisk_click2dial.py

@ -33,12 +33,13 @@ class asterisk_server(osv.osv):
_description = "Asterisk Servers" _description = "Asterisk Servers"
_columns = { _columns = {
'name' : fields.char('Asterisk server name', size=50, required=True, help="Asterisk server name."), 'name' : fields.char('Asterisk server name', size=50, required=True, help="Asterisk server name."),
'active' : fields.boolean('Active', help="The active field allows you to hide the Asterisk server without deleting it."),
'ip_address' : fields.char('Asterisk IP addr. or DNS', size=50, required=True, help="IPv4 address or DNS name of the Asterisk server."), 'ip_address' : fields.char('Asterisk IP addr. or DNS', size=50, required=True, help="IPv4 address or DNS name of the Asterisk server."),
'port' : fields.integer('Port', required=True, help="TCP port on which the Asterisk Manager Interface listens. Defined in /etc/asterisk/manager.conf on Asterisk."), 'port' : fields.integer('Port', required=True, help="TCP port on which the Asterisk Manager Interface listens. Defined in /etc/asterisk/manager.conf on Asterisk."),
'out_prefix' : fields.char('Out prefix', size=4, help="Prefix to dial to place outgoing calls. If you don't use a prefix to place outgoing calls, leave empty."), 'out_prefix' : fields.char('Out prefix', size=4, help="Prefix to dial to place outgoing calls. If you don't use a prefix to place outgoing calls, leave empty."),
'national_prefix' : fields.char('National prefix', size=4, help="Prefix for national phone calls (don't include the 'out prefix'). For e.g., in France, the phone numbers look like '01 41 98 12 42' : the National prefix is '0'."), 'national_prefix' : fields.char('National prefix', size=4, help="Prefix for national phone calls (don't include the 'out prefix'). For e.g., in France, the phone numbers look like '01 41 98 12 42' : the National prefix is '0'."),
'international_prefix' : fields.char('International prefix', size=4, help="Prefix to add to make international phone calls (don't include the 'out prefix'). For e.g., in France, the International prefix is '00'."), 'international_prefix' : fields.char('International prefix', size=4, help="Prefix to add to make international phone calls (don't include the 'out prefix'). For e.g., in France, the International prefix is '00'."),
'country_prefix' : fields.char('My country prefix', size=4, help="Phone prefix of the country where the Asterisk server is located. For e.g. the phone prefix for France is '33'. If the phone number to dial starts with the 'My country prefix', OpenERP will remove the country prefix from the phone number and add the 'out prefix' followed by the 'national prefix'. If the phone number to dial doesn't start with the 'My country prefix', OpenERP will add the 'out prefix' followed by the 'international prefix'."),
'country_prefix' : fields.char('My country prefix', required=True, size=4, help="Phone prefix of the country where the Asterisk server is located. For e.g. the phone prefix for France is '33'. If the phone number to dial starts with the 'My country prefix', OpenERP will remove the country prefix from the phone number and add the 'out prefix' followed by the 'national prefix'. If the phone number to dial doesn't start with the 'My country prefix', OpenERP will add the 'out prefix' followed by the 'international prefix'."),
'national_format_allowed' : fields.boolean('National format allowed ?', help="Do we allow to use click2dial on phone numbers written in national format, e.g. 01 41 98 12 42, or only in the international format, e.g. +33 1 41 98 12 42 ?"), 'national_format_allowed' : fields.boolean('National format allowed ?', help="Do we allow to use click2dial on phone numbers written in national format, e.g. 01 41 98 12 42, or only in the international format, e.g. +33 1 41 98 12 42 ?"),
'login' : fields.char('AMI login', size=30, required=True, help="Login that OpenERP will use to communicate with the Asterisk Manager Interface. Refer to /etc/asterisk/manager.conf on your Asterisk server."), 'login' : fields.char('AMI login', size=30, required=True, help="Login that OpenERP will use to communicate with the Asterisk Manager Interface. Refer to /etc/asterisk/manager.conf on your Asterisk server."),
'password' : fields.char('AMI password', size=30, required=True, help="Password that Asterisk will use to communicate with the Asterisk Manager Interface. Refer to /etc/asterisk/manager.conf on your Asterisk server."), 'password' : fields.char('AMI password', size=30, required=True, help="Password that Asterisk will use to communicate with the Asterisk Manager Interface. Refer to /etc/asterisk/manager.conf on your Asterisk server."),
@ -50,6 +51,7 @@ class asterisk_server(osv.osv):
} }
_defaults = { _defaults = {
'active': lambda *a: 1,
'port': lambda *a: 5038, # Default AMI port 'port': lambda *a: 5038, # Default AMI port
'out_prefix': lambda *a: '0', 'out_prefix': lambda *a: '0',
'national_prefix': lambda *a: '0', 'national_prefix': lambda *a: '0',

80
asterisk_click2dial/asterisk_server_view.xml

@ -23,7 +23,7 @@
</field> </field>
</record> </record>
<!-- Form view for asterisk.server -->
<!-- Form view for asterisk.server inside Company view -->
<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>
@ -31,6 +31,7 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Asterisk servers"> <form string="Asterisk servers">
<field name="name" select="1" /> <field name="name" select="1" />
<field name="active" select="2" />
<field name="ip_address" select="1" /> <field name="ip_address" select="1" />
<field name="port" select="2" /> <field name="port" select="2" />
<field name="login" select="2" /> <field name="login" select="2" />
@ -48,7 +49,7 @@
</field> </field>
</record> </record>
<!-- Tree view for asterisk.server -->
<!-- Tree view for asterisk.server inside company view -->
<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>
@ -63,13 +64,84 @@
</field> </field>
</record> </record>
<!-- Action for asterisk.server -->
<!-- Action for asterisk.server inside company view -->
<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>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
</record> </record>
<!-- Form view for asterisk.server - standalone -->
<record id="view_asterisk_server_standalone_form" model="ir.ui.view">
<field name="name">asterisk.server.standalone.form</field>
<field name="model">asterisk.server</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Asterisk servers">
<field name="company_id" select="1" />
<newline />
<field name="name" select="1" />
<field name="active" select="2" />
<field name="ip_address" select="1" />
<field name="port" select="2" />
<field name="login" select="2" />
<field name="password" password="True" />
<field name="context" />
<field name="extension_priority" />
<field name="out_prefix" />
<field name="national_prefix" />
<field name="international_prefix" />
<field name="country_prefix" select="1" />
<field name="national_format_allowed" />
<field name="alert_info" />
<field name="wait_time" />
</form>
</field>
</record>
<!-- Tree view for asterisk.server - standalone -->
<record id="view_asterisk_server_standalone_tree" model="ir.ui.view">
<field name="name">asterisk.server.standalone.tree</field>
<field name="model">asterisk.server</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Asterisk servers">
<field name="company_id" />
<field name="name" />
<field name="ip_address" />
<field name="port" />
<field name="country_prefix" />
</tree>
</field>
</record>
<!-- Action for asterisk.server - standalone -->
<record id="action_asterisk_server_standalone" model="ir.actions.act_window">
<field name="name">Asterisk servers</field>
<field name="res_model">asterisk.server</field>
<field name="view_type">form</field>
</record>
<!-- Action view "tree" for asterisk.server - standalone -->
<record id="action_asterisk_server_standalone_tree" model="ir.actions.act_window.view">
<field eval="10" name="sequence"/> <!-- open tree view first -->
<field name="view_mode">tree</field>
<field name="view_id" ref="view_asterisk_server_standalone_tree" />
<field name="act_window_id" ref="action_asterisk_server_standalone" />
</record>
<!-- Action view "form" for asterisk.server - standalone -->
<record id="action_asterisk_server_standalone_form" model="ir.actions.act_window.view">
<field eval="20" name="sequence"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_asterisk_server_standalone_form" />
<field name="act_window_id" ref="action_asterisk_server_standalone" />
</record>
<!-- Menu entry under Administration > Configuration -->
<menuitem action="action_asterisk_server_standalone" id="act_menu_ast_server" parent="base.menu_config" />
</data> </data>
</openerp> </openerp>
Loading…
Cancel
Save