[IMP] project: add function to open attachments related to the project.

bzr revid: tpa@tinyerp.com-20120601094424-gs2k68izgcedpnx5
This commit is contained in:
Turkesh Patel (Open ERP)
2012-06-01 15:14:24 +05:30
parent 10ffd100e1
commit 18f8ec4486
2 changed files with 19 additions and 0 deletions
+14
View File
@@ -200,6 +200,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'),
'use_attachment': fields.boolean('Tasks Management'),
}
def dummy(self, cr, uid, ids, context):
@@ -456,6 +457,19 @@ def Project():
}, context=context)
return True
def open_attachment(self, cr, uid, ids, context=None):
if context is None:
context = {}
return {
'name': 'Attachments',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'ir.attachment',
'domain': [('res_id','=',ids[0])],
'type': 'ir.actions.act_window',
}
# ------------------------------------------------
# OpenChatter methods and notifications
# ------------------------------------------------
+5
View File
@@ -60,6 +60,11 @@
<td><field name="use_tasks" nolabel="1"/></td>
<td style="text-align:right;" width="110px"><button class="oe_btn_width" name="%(act_project_project_2_project_task_all)d" string="Tasks" type="action" attrs="{'invisible':[('use_tasks','=', 0)]}"/></td>
</tr>
<tr name="use_attachment_row">
<th style="border-right:1px solid #DDD;" width="140px">Attachment</th>
<td><field name="use_attachment" nolabel="1"/></td>
<td style="text-align:right;" width="110px"><button class="oe_btn_width" name="open_attachment" string="Attachments" type="object" attrs="{'invisible':[('use_attachment','=', 0)]}"/></td>
</tr>
</table>
</group>
</group>