[IMP] proj: optionalize default alias generation
This commit is contained in:
committed by
Richard Mathot
parent
fe763980f2
commit
dd9f10a6a4
@@ -531,7 +531,11 @@ def Project():
|
||||
|
||||
project_id = super(project, self).create(cr, uid, vals, context=create_context)
|
||||
project_rec = self.browse(cr, uid, project_id, context=context)
|
||||
self.pool.get('mail.alias').write(cr, uid, [project_rec.alias_id.id], {'alias_parent_thread_id': project_id, 'alias_defaults': {'project_id': project_id}}, context)
|
||||
ir_values = self.pool.get('ir.values').get_default( cr, uid, 'project.config.settings', 'generate_project_alias' )
|
||||
values = { 'alias_parent_thread_id': project_id, 'alias_defaults': {'project_id': project_id}}
|
||||
if ir_values:
|
||||
values = dict(values, alias_name=vals['name'])
|
||||
self.pool.get('mail.alias').write(cr, uid, [project_rec.alias_id.id], values, context=context)
|
||||
return project_id
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
|
||||
@@ -58,6 +58,8 @@ class project_configuration(osv.osv_memory):
|
||||
'group_manage_delegation_task': fields.boolean("Allow task delegation",
|
||||
implied_group='project.group_delegate_task',
|
||||
help="Allows you to delegate tasks to other users."),
|
||||
'generate_project_alias': fields.boolean("Automatically generate an email alias at the project creation",
|
||||
help="Odoo will generate an email alias at the project creation from project name."),
|
||||
}
|
||||
|
||||
def get_default_time_unit(self, cr, uid, fields, context=None):
|
||||
@@ -74,4 +76,8 @@ class project_configuration(osv.osv_memory):
|
||||
return {'value': {'group_tasks_work_on_tasks': True}}
|
||||
return {}
|
||||
|
||||
def set_default_generate_project_alias(self, cr, uid, ids, context=None):
|
||||
config_value = self.browse(cr, uid, ids, context=context).generate_project_alias
|
||||
self.pool.get('ir.values').set_default(cr, uid, 'project.config.settings', 'generate_project_alias', config_value)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -63,6 +63,15 @@
|
||||
</div>
|
||||
</div>
|
||||
</group>
|
||||
<group>
|
||||
<label for="id" string="Communication"/>
|
||||
<div>
|
||||
<div>
|
||||
<field name="generate_project_alias" class="oe_inline"/>
|
||||
<label for="generate_project_alias" />
|
||||
</div>
|
||||
</div>
|
||||
</group>
|
||||
<separator string="Helpdesk & Support"/>
|
||||
<group>
|
||||
<label for="id" string="Support"/>
|
||||
|
||||
Reference in New Issue
Block a user