diff options
| author | Christophe Simonis <chs@openerp.com> | 2013-09-10 14:48:03 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@openerp.com> | 2013-09-10 14:48:03 +0200 |
| commit | 3fa90321e11d28df4e2b874ddfa450dc73e8e0af (patch) | |
| tree | 91546d220e866fa6fb1807f1e8b44c5c28a6bc76 /addons/project | |
| parent | 4327e09a55e74e59e6c0ae41883951d41e7146e5 (diff) | |
| parent | 546a191f0a790415317c55f41e30ced88bfc143b (diff) | |
[MERGE] forward port of branch saas-1 up to revid 8772 chs@openerp.com-20130910122113-171osvcukxffxcry
bzr revid: chs@openerp.com-20130910124803-wxkb8gkz1tub5qjf
Diffstat (limited to 'addons/project')
| -rw-r--r-- | addons/project/project.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/addons/project/project.py b/addons/project/project.py index 139d007d3ab..d153a849dc7 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -265,7 +265,7 @@ class project(osv.osv): 'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Tasks Stages', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}), 'task_count': fields.function(_task_count, type='integer', string="Open Tasks"), 'color': fields.integer('Color Index'), - 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="cascade", required=True, + 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="restrict", required=True, help="Internal email associated with this project. Incoming emails are automatically synchronized" "with Tasks (or optionally Issues if the Issue Tracker module is installed)."), 'alias_model': fields.selection(_alias_models, "Alias Model", select=True, required=True, @@ -717,6 +717,16 @@ class task(osv.osv): new_name = _("%s (copy)") % (default.get('name', '')) default.update({'name':new_name}) return super(task, self).copy_data(cr, uid, id, default, context) + + def copy(self, cr, uid, id, default=None, context=None): + if context is None: + context = {} + if default is None: + default = {} + stage = self._get_default_stage_id(cr, uid, context=context) + if stage: + default['stage_id'] = stage + return super(task, self).copy(cr, uid, id, default, context) def _is_template(self, cr, uid, ids, field_name, arg, context=None): res = {} @@ -1248,6 +1258,18 @@ class account_analytic_account(osv.osv): raise osv.except_osv(_('Warning!'), _('Please delete the project linked with this account first.')) return super(account_analytic_account, self).unlink(cr, uid, ids, *args, **kwargs) + def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100): + if args is None: + args = [] + if context is None: + context={} + if context.get('current_model') == 'project.project': + project_ids = self.search(cr, uid, args + [('name', operator, name)], limit=limit, context=context) + return self.name_get(cr, uid, project_ids, context=context) + + return super(account_analytic_account, self).name_search(cr, uid, name, args=args, operator=operator, context=context, limit=limit) + + class project_project(osv.osv): _inherit = 'project.project' _defaults = { |
