duration = float(ans.days)
res[issue.id][field] = abs(float(duration))
return res
+
+
+ def attachment_tree_view(self, cr, uid, ids, context):
+ domain = ['&', ('res_model', '=', 'hr.applicant'), ('res_id', 'in', ids)]
+ res_id = ids and ids[0] or False
+ return {
+ 'name': _('Attachments'),
+ 'domain': domain,
+ 'res_model': 'ir.attachment',
+ 'type': 'ir.actions.act_window',
+ 'view_id': False,
+ 'view_mode': 'tree,form',
+ 'view_type': 'form',
+ 'limit': 80,
+ 'context': "{'default_res_model': '%s','default_res_id': %d}" % (self._name, res_id)
+ }
+
+ def _compute_attachments(self, cr, uid, ids, fields, args, context=None):
+ res = {}
+ attachment_pool = self.pool.get('ir.attachment')
+ for applicant in ids:
+ res[applicant] = attachment_pool.search_count(cr, uid, [('res_model', '=', 'hr.applicant'), ('res_id', '=', applicant)], context=context)
+ return res
_columns = {
- 'name': fields.char('Subject', size=128, required=True),
+ 'name': fields.char('Subject / Application Name', size=128, required=True),
'active': fields.boolean('Active', help="If the active field is set to false, it will allow you to hide the case without removing it."),
'description': fields.text('Description'),
'email_from': fields.char('Email', size=128, help="These people will receive email."),