From f816f75de9df1cc1ff3235c0157797443422e17c Mon Sep 17 00:00:00 2001 From: "RGA(OpenERP)" <> Date: Thu, 1 Nov 2012 17:27:57 +0530 Subject: [PATCH] [IMP] Add context for set default value of document bzr revid: rgaopenerp-20121101115757-6vl76bt4mjqe37us --- addons/project/project.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/project/project.py b/addons/project/project.py index a182185be98..744b68c4cc2 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -207,7 +207,7 @@ class project(osv.osv): task_ids = self.pool.get('project.task').search(cr, uid, [('project_id', 'in', ids)]) task_attachments = attachment.search(cr, uid, [('res_model', '=', 'project.task'), ('res_id', 'in', task_ids)], context=context) all_attachment = project_attachments + task_attachments - + res_id = ids and ids[0] or False return { 'name': _('Attachments'), 'domain': [('id','in', all_attachment)], @@ -217,6 +217,7 @@ class project(osv.osv): 'view_mode': 'tree,form', 'view_type': 'form', 'limit': 80, + 'context': "{'default_res_model': '%s','default_res_id': %d}" % (self._name, res_id) } # Lambda indirection method to avoid passing a copy of the overridable method when declaring the field _alias_models = lambda self, *args, **kwargs: self._get_alias_models(*args, **kwargs)