summaryrefslogtreecommitdiff
path: root/addons/project/project.py
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2015-06-15 16:31:27 +0200
committerGéry Debongnie <ged@odoo.com>2015-06-15 16:31:27 +0200
commit2c7367a8cc8d9e200b1fa2083ce0d80f8f4e4bd3 (patch)
treeaf916cff4d94554b1e9667913e3feb331ec81a13 /addons/project/project.py
parent5cb10d4fc9594f0c6825757c24d66d63664ce026 (diff)
parent82186a93bb3f93c36667835df68fa31dcacf97a2 (diff)
[MERGE] new kanban view
This branch introduces the new kanban view. It is not completely compatible with the previous version. Here are a few importants points to be aware of: * the kanban view template is rendered directly, not put inside a div. It means that if a template has more than one root, chaos will ensue * kanban view has been split into several files, and various js modules have changed. For example, the KanbanRecord class is now exported by the 'web_kanban.Record' module. So, require statements need to be updated * records do not have access to the view (i.e., record.view.is_action_enabled('edit')) You can use the 'editable' and 'deletable' key instead
Diffstat (limited to 'addons/project/project.py')
-rw-r--r--addons/project/project.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/addons/project/project.py b/addons/project/project.py
index b75a0e2fa95..fdffb68ed86 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -556,6 +556,12 @@ class task(osv.osv):
res[task.id] = False
return res
+ def _compute_displayed_image(self, cr, uid, ids, prop, arg, context=None):
+ res = {}
+ for line in self.browse(cr, uid, ids, context=context):
+ res[line.id] = line.attachment_ids and line.attachment_ids.filtered(lambda x: x.file_type_icon == 'webimage')[0] or None
+ return res
+
_columns = {
'active': fields.function(_is_template, store=True, string='Not a Template Task', type='boolean', help="This field is computed automatically and have the same behavior than the boolean 'active' field: if the task is linked to a template or unactivated project, it will be hidden unless specifically asked."),
'name': fields.char('Task Summary', track_visibility='onchange', size=128, required=True, select=True),
@@ -592,7 +598,9 @@ class task(osv.osv):
'id': fields.integer('ID', readonly=True),
'color': fields.integer('Color Index'),
'user_email': fields.related('user_id', 'email', type='char', string='User Email', readonly=True),
- }
+ 'attachment_ids': fields.one2many('ir.attachment', 'res_id', domain=lambda self: [('res_model', '=', self._name)], auto_join=True, string='Attachments'),
+ 'displayed_image_id': fields.function(_compute_displayed_image, relation='ir.attachment', type="many2one", string='Attachment'),
+ }
_defaults = {
'stage_id': _get_default_stage_id,
'project_id': lambda self, cr, uid, ctx=None: ctx.get('default_project_id') if ctx is not None else False,