Skip to content
Permalink
Browse files

[FIX] project: fix can't edit attachment with studio

Issue

    - Install Projects & Studio
    - Go into projects app
    - Edit a project (... => Edit)
    - Click on x attachments stat button

    You can't edit with studio

Cause

    Writing the action manually instead of using the base one
    result with an empty xml_id (and a lot of missing data).

Solution

    Use base.action_attachment like others modules do (e.g. helpdesk).

OPW-2146741

closes #43260

X-original-commit: 856b09d
Signed-off-by: Jason Van Malder <jvm-odoo@users.noreply.github.com>
  • Loading branch information
jvm-odoo committed Jan 10, 2020
1 parent af8d31d commit ce31b42278e291c21a9c1452841e5a57ebef1db4
Showing with 12 additions and 19 deletions.
  1. +12 −19 addons/project/models/project.py
@@ -96,26 +96,19 @@ def _compute_task_count(self):
project.task_count = result.get(project.id, 0)

def attachment_tree_view(self):
self.ensure_one()
domain = [
attachment_action = self.env.ref('base.action_attachment')
action = attachment_action.read()[0]
action['domain'] = str([
'|',
'&', ('res_model', '=', 'project.project'), ('res_id', 'in', self.ids),
'&', ('res_model', '=', 'project.task'), ('res_id', 'in', self.task_ids.ids)]
return {
'name': _('Attachments'),
'domain': domain,
'res_model': 'ir.attachment',
'type': 'ir.actions.act_window',
'view_id': False,
'view_mode': 'kanban,tree,form',
'help': _('''<p class="o_view_nocontent_smiling_face">
Documents are attached to the tasks of your project.</p><p>
Send messages or log internal notes with attachments to link
documents to your project.
</p>'''),
'limit': 80,
'context': "{'default_res_model': '%s','default_res_id': %d}" % (self._name, self.id)
}
'&',
('res_model', '=', 'project.project'),
('res_id', 'in', self.ids),
'&',
('res_model', '=', 'project.task'),
('res_id', 'in', self.task_ids.ids)
])
action['context'] = "{'default_res_model': '%s','default_res_id': %d}" % (self._name, self.id)
return action

@api.model
def activate_sample_project(self):

0 comments on commit ce31b42

Please sign in to comment.
You can’t perform that action at this time.