diff --git a/addons/project/__openerp__.py b/addons/project/__openerp__.py index f8356dfb5a0..63c44af1b44 100644 --- a/addons/project/__openerp__.py +++ b/addons/project/__openerp__.py @@ -47,6 +47,7 @@ Dashboard / Reports for Project Management will include: 'project_dashboard.xml', 'web_planner_data.xml', ], + 'qweb': ['static/src/xml/project.xml'], 'demo': ['project_demo.xml'], 'test': [ ], diff --git a/addons/project/project.py b/addons/project/project.py index 7197f8b60cf..cd8aadb5ba5 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -411,12 +411,6 @@ class task(osv.osv): default['name'] = _("%s (copy)") % current.name return super(task, self).copy_data(cr, uid, id, default, context) - 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.mimetype.startswith('image'))[0] or None - return res - _columns = { 'active': fields.boolean('Active'), 'name': fields.char('Task Title', track_visibility='onchange', size=128, required=True, select=True), @@ -454,7 +448,8 @@ class task(osv.osv): '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'), + # In the domain of displayed_image_id, we couln't use attachment_ids because a one2many is represented as a list of commands so we used res_model & res_id + 'displayed_image_id': fields.many2one('ir.attachment', domain="[('res_model', '=', 'project.task'), ('res_id', '=', id), ('mimetype', 'ilike', 'image')]", string='Displayed Image'), } _defaults = { 'stage_id': _get_default_stage_id, diff --git a/addons/project/project_data.xml b/addons/project/project_data.xml index 50cefce0bf5..b4169fec188 100644 --- a/addons/project/project_data.xml +++ b/addons/project/project_data.xml @@ -249,6 +249,10 @@ + + + + 0 @@ -303,6 +307,10 @@ + + + + diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index b4d3a7a7e64..7f168feaff4 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -290,6 +290,7 @@ + @@ -324,6 +325,7 @@ + @@ -335,6 +337,7 @@