[IMP] improved code for incoming server configuration
bzr revid: tpa@tinyerp.com-20120314123206-zg8u3sc4oy3dc0u8
This commit is contained in:
parent
dbe694c645
commit
aca13da679
|
@ -201,4 +201,11 @@ class specify_partner_terminology(osv.osv_memory):
|
|||
self.make_translations(cr, uid, ids, act_ref, 'model', act_id.help, _case_insensitive_replace(act_id.help,'Customer',o.partner), res_id=act_id.id, context=context)
|
||||
return {}
|
||||
|
||||
|
||||
# Preferences wizard for Project & crm.
|
||||
# It is defined here because it must be inherited independently in modules project and crm.
|
||||
class project_config_settings(osv.osv_memory):
|
||||
_name = 'project.config.settings'
|
||||
_inherit = 'res.config.settings'
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
<!--
|
||||
<!--
|
||||
<record id="config_action_partner_terminology_config_form" model="ir.actions.todo">
|
||||
<field name="action_id" ref="action_partner_terminology_config_form"/>
|
||||
<field name="category_id" ref="base.category_administration_config"/>
|
||||
|
@ -142,5 +142,30 @@
|
|||
<field name="sequence">1</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="base.project_settings_form_view" model="ir.ui.view">
|
||||
<field name="name">project.config.settings</field>
|
||||
<field name="model">project.config.settings</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Configure Project">
|
||||
<group name="Project" colspan="4">
|
||||
</group>
|
||||
<group name="Helpdesk and support" colspan="4">
|
||||
<separator string="Helpdesk and support" colspan="4"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="base.action_project_config" model="ir.actions.act_window">
|
||||
<field name="name">Configure Project</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">project.config.settings</field>
|
||||
<field name="view_id" ref="base.project_settings_form_view"/>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -25,12 +25,14 @@ import pooler
|
|||
from tools.translate import _
|
||||
|
||||
class project_configuration(osv.osv_memory):
|
||||
_inherit = 'res.config.settings'
|
||||
_inherit = 'project.config.settings'
|
||||
|
||||
def get_default_email_configurations(self, cr, uid, ids, context=None):
|
||||
fetchmail_obj = self.pool.get('fetchmail.server')
|
||||
result = {}
|
||||
issue_ids = fetchmail_obj.search(cr, uid, [('name','=','Incoming Issues'),('state','!=','done')])
|
||||
if issue_ids:
|
||||
result.update({'project_issue': True})
|
||||
if issue_ids:
|
||||
issue_id = fetchmail_obj.browse(cr, uid, issue_ids[0], context=context)
|
||||
result.update({'issue_server': issue_id.server})
|
||||
|
@ -41,6 +43,8 @@ class project_configuration(osv.osv_memory):
|
|||
result.update({'issue_password': issue_id.password})
|
||||
|
||||
claim_ids = fetchmail_obj.search(cr, uid, [('name','=','Incoming Claims'),('state','!=','done')])
|
||||
if claim_ids:
|
||||
result.update({'crm_claim': True})
|
||||
if claim_ids:
|
||||
claim_id = fetchmail_obj.browse(cr, uid, claim_ids[0], context=context)
|
||||
result.update({'claim_server': claim_id.server})
|
||||
|
@ -59,7 +63,7 @@ class project_configuration(osv.osv_memory):
|
|||
issue_id = model_obj.search(cr, uid, [('model','=','project.issue')])
|
||||
claim_id = model_obj.search(cr, uid, [('model','=','crm.claim')])
|
||||
vals = self.read(cr, uid, ids[0], [], context=context)
|
||||
if vals.get('module_project_issue') and issue_id:
|
||||
if vals.get('project_issue') and issue_id:
|
||||
issue_vals = {
|
||||
'name': 'Incoming Issues',
|
||||
'object_id': issue_id[0],
|
||||
|
@ -82,7 +86,7 @@ class project_configuration(osv.osv_memory):
|
|||
server_ids = fetchmail_obj.search(cr, uid, [('name','=','Incoming Issues'),('state','=','done')])
|
||||
fetchmail_obj.set_draft(cr, uid, server_ids, context=None)
|
||||
|
||||
if vals.get('module_crm_claim') and claim_id:
|
||||
if vals.get('crm_claim') and claim_id:
|
||||
claim_vals = {
|
||||
'name': 'Incoming Claims',
|
||||
'object_id': claim_id[0],
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
'init_xml': [],
|
||||
'update_xml': [
|
||||
"installer.xml",
|
||||
"res_config_view.xml",
|
||||
],
|
||||
'demo_xml': [
|
||||
],
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_project_config_claim" model="ir.ui.view">
|
||||
<field name="name">Project Application</field>
|
||||
<field name="model">project.config.settings</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="base.project_settings_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//form/group[@name='Helpdesk and support']" position="inside">
|
||||
<field name="crm_claim"/>
|
||||
<group col="4" colspan="2" attrs="{'invisible': [('crm_claim','=',False)]}">
|
||||
<field name="claim_server" attrs="{'required': [('crm_claim','=',True)]}"/>
|
||||
<field name="claim_type" nolabel="1" on_change="onchange_server_type(claim_type, claim_is_ssl,'claim')" attrs="{'required': [('crm_claim','=',True)]}"/>
|
||||
<field name="claim_port" attrs="{'required': [('crm_claim','=',True)]}"/>
|
||||
<field name="claim_is_ssl" on_change="onchange_server_type(claim_type, claim_is_ssl,'claim')"/>
|
||||
<newline/>
|
||||
<field name="claim_user" attrs="{'required': [('crm_claim','=',True)]}"/>
|
||||
<field name="claim_password" password="True" attrs="{'required': [('crm_claim','=',True)]}"/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -24,7 +24,7 @@ import pooler
|
|||
from tools.translate import _
|
||||
|
||||
class project_configuration(osv.osv_memory):
|
||||
_inherit = 'res.config.settings'
|
||||
_inherit = 'project.config.settings'
|
||||
|
||||
_columns = {
|
||||
'module_project_mrp': fields.boolean('Allow to create tasks directly from a sale order',
|
||||
|
@ -57,9 +57,8 @@ class project_configuration(osv.osv_memory):
|
|||
'module_project_issue_sheet': fields.boolean("Track and invoice working time",
|
||||
help="""Allows to the timesheet support for the Issues/Bugs Management in Project.
|
||||
It installs the project_issue_sheet module."""),
|
||||
'module_project_issue': fields.boolean("Create issue from an email account",
|
||||
help="""This allows you issues/bugs management in project
|
||||
It installs the project_issue module."""),
|
||||
'project_issue': fields.boolean("Create issue from an email account",
|
||||
help="""Allows you to configure your incoming mail server. And creates issue for your mails."""),
|
||||
'issue_server' : fields.char('Server Name', size=256),
|
||||
'issue_port' : fields.integer('Port'),
|
||||
'issue_type': fields.selection([
|
||||
|
@ -70,9 +69,9 @@ class project_configuration(osv.osv_memory):
|
|||
'issue_is_ssl': fields.boolean('SSL/TLS', help="Connections are encrypted with SSL/TLS through a dedicated port (default: IMAPS=993, POP=995)"),
|
||||
'issue_user' : fields.char('Username', size=256),
|
||||
'issue_password' : fields.char('Password', size=1024),
|
||||
'module_crm_claim': fields.boolean("Create claims from an email account",
|
||||
help="""This allows you to track your customers/suppliers claims and grievances.
|
||||
It installs the crm_claim module."""),
|
||||
'crm_claim': fields.boolean("Create claims from an email account",
|
||||
help="""Allows you to configure your incoming mail server. And creates claims for your mails.
|
||||
"""),
|
||||
'claim_server' : fields.char('Server Name', size=256),
|
||||
'claim_port' : fields.integer('Port'),
|
||||
'claim_type': fields.selection([
|
||||
|
@ -103,7 +102,6 @@ class project_configuration(osv.osv_memory):
|
|||
values[type+'_port'] = port
|
||||
return {'value': values}
|
||||
|
||||
|
||||
project_configuration()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -3,75 +3,49 @@
|
|||
|
||||
<record id="view_project_config" model="ir.ui.view">
|
||||
<field name="name">Project Application</field>
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="model">project.config.settings</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="base.project_settings_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<form string ="Project Application">
|
||||
<separator string="Project" colspan="4"/>
|
||||
<group colspan="4" col="8">
|
||||
<group colspan="4" col="4">
|
||||
<field name="module_project_mrp"/>
|
||||
<newline/>
|
||||
<field name="module_pad"/>
|
||||
<newline/>
|
||||
</group>
|
||||
<group colspan="4" col="4">
|
||||
<newline/>
|
||||
<field name="module_project_timesheet"/>
|
||||
<newline/>
|
||||
<field name="module_project_scrum"/>
|
||||
<newline/>
|
||||
</group>
|
||||
</group>
|
||||
<xpath expr="//form/group[@name='Project']" position="inside">
|
||||
<group name="Project" position="inside">
|
||||
<separator string="Project" colspan="4"/>
|
||||
<group colspan="4" col="8">
|
||||
<group colspan="4" col="4">
|
||||
<field name="module_project_mrp"/>
|
||||
<newline/>
|
||||
<field name="module_pad"/>
|
||||
<newline/>
|
||||
</group>
|
||||
<group colspan="4" col="4">
|
||||
<newline/>
|
||||
<field name="module_project_timesheet"/>
|
||||
<newline/>
|
||||
<field name="module_project_scrum"/>
|
||||
<newline/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
<separator string="Planning" colspan="4"/>
|
||||
<group colspan="4" col="4">
|
||||
<group colspan="4" col="4">
|
||||
<field name="module_project_planning"/>
|
||||
</group>
|
||||
<group colspan="4" col="4">
|
||||
<field name="module_project_long_term"/>
|
||||
</group>
|
||||
</group>
|
||||
<separator string="Planning" colspan="4"/>
|
||||
<group colspan="4" col="4">
|
||||
<group colspan="4" col="4">
|
||||
<field name="module_project_planning"/>
|
||||
</group>
|
||||
<group colspan="4" col="4">
|
||||
<field name="module_project_long_term"/>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//form/group[@name='Helpdesk and support']" position="inside">
|
||||
<field name="module_project_issue_sheet" colspan="4"/>
|
||||
</xpath>
|
||||
|
||||
<separator string="Helpdesk and support" colspan="4"/>
|
||||
<group colspan="4" col="4">
|
||||
<field name="module_project_issue"/>
|
||||
<group col="4" colspan="2" attrs="{'invisible': [('module_project_issue','=',False)]}">
|
||||
<field name="issue_server" attrs="{'required': [('module_project_issue','=',True)]}"/>
|
||||
<field name="issue_type" nolabel="1" on_change="onchange_server_type(issue_type, issue_is_ssl,'issue')" attrs="{'required': [('module_project_issue','=',True)]}"/>
|
||||
<field name="issue_port" attrs="{'required': [('module_project_issue','=',True)]}"/>
|
||||
<field name="issue_is_ssl" on_change="onchange_server_type(issue_type, issue_is_ssl, 'issue')"/>
|
||||
<newline/>
|
||||
<field name="issue_user" attrs="{'required': [('module_project_issue','=',True)]}"/>
|
||||
<field name="issue_password" password="True" attrs="{'required': [('module_project_issue','=',True)]}"/>
|
||||
</group>
|
||||
<field name="module_crm_claim"/>
|
||||
<group col="4" colspan="2" attrs="{'invisible': [('module_crm_claim','=',False)]}">
|
||||
<field name="claim_server" attrs="{'required': [('module_crm_claim','=',True)]}"/>
|
||||
<field name="claim_type" nolabel="1" on_change="onchange_server_type(claim_type, claim_is_ssl,'claim')" attrs="{'required': [('module_crm_claim','=',True)]}"/>
|
||||
<field name="claim_port" attrs="{'required': [('module_crm_claim','=',True)]}"/>
|
||||
<field name="claim_is_ssl" on_change="onchange_server_type(claim_type, claim_is_ssl,'claim')"/>
|
||||
<newline/>
|
||||
<field name="claim_user" attrs="{'required': [('module_crm_claim','=',True)]}"/>
|
||||
<field name="claim_password" password="True" attrs="{'required': [('module_crm_claim','=',True)]}"/>
|
||||
</group>
|
||||
<field name="module_project_issue_sheet" colspan="4"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_project_configuration" model="ir.actions.act_window">
|
||||
<field name="name">Configure Project Application</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">res.config.settings</field>
|
||||
<field name="view_id" ref="view_project_config"/>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="base.menu_project_config" name="Project" parent="base.menu_config" sequence="1" action="action_project_configuration"/>
|
||||
<menuitem id="base.menu_project_config" name="Project" parent="base.menu_config" sequence="1" action="base.action_project_config"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -52,6 +52,7 @@ and decide on their status as they evolve.
|
|||
'security/project_issue_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
"board_project_issue_view.xml",
|
||||
"res_config_view.xml",
|
||||
],
|
||||
'demo_xml': ['project_issue_demo.xml'],
|
||||
'test': [
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_project_config_issue" model="ir.ui.view">
|
||||
<field name="name">Project Application</field>
|
||||
<field name="model">project.config.settings</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="project.view_project_config"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//form/group[@name='Helpdesk and support']" position="inside">
|
||||
<field name="project_issue"/>
|
||||
<group col="4" colspan="2" attrs="{'invisible': [('project_issue','=',False)]}">
|
||||
<field name="issue_server" attrs="{'required': [('project_issue','=',True)]}"/>
|
||||
<field name="issue_type" nolabel="1" on_change="onchange_server_type(issue_type, issue_is_ssl,'issue')" attrs="{'required': [('project_issue','=',True)]}"/>
|
||||
<field name="issue_port" attrs="{'required': [('project_issue','=',True)]}"/>
|
||||
<field name="issue_is_ssl" on_change="onchange_server_type(issue_type, issue_is_ssl, 'issue')"/>
|
||||
<newline/>
|
||||
<field name="issue_user" attrs="{'required': [('project_issue','=',True)]}"/>
|
||||
<field name="issue_password" password="True" attrs="{'required': [('project_issue','=',True)]}"/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
Loading…
Reference in New Issue