diff --git a/addons/pad_project/__manifest__.py b/addons/pad_project/__manifest__.py index 846b98c68ba..142784a1c91 100644 --- a/addons/pad_project/__manifest__.py +++ b/addons/pad_project/__manifest__.py @@ -14,7 +14,9 @@ This module adds a PAD in all project form views. ], 'data': [ 'views/res_config_settings_views.xml', - 'views/project_views.xml' + 'views/project_views.xml', + 'views/project_portal_templates.xml', + 'views/project_portal_assets.xml' ], 'auto_install': True, } diff --git a/addons/pad_project/models/project.py b/addons/pad_project/models/project.py index 40cfbfdbf10..8c58209a200 100644 --- a/addons/pad_project/models/project.py +++ b/addons/pad_project/models/project.py @@ -11,6 +11,10 @@ class ProjectTask(models.Model): description_pad = fields.Char('Pad URL', pad_content_field='description', copy=False) use_pad = fields.Boolean(related="project_id.use_pads", string="Use collaborative pad", readonly=True) + pad_availability = fields.Selection( + related="project_id.pad_availability", + string="Availability of collaborative pads", + readonly=True) @api.model def create(self, vals): @@ -20,8 +24,37 @@ class ProjectTask(models.Model): self = self.with_context(pad_no_create=True) return super(ProjectTask, self).create(vals) + def _use_portal_pad(self): + """ + Indicates if the task configuration requires to provide + an access to a portal pad. + """ + self.ensure_one() + return self.use_pad and self.pad_availability == 'portal' + + def _get_pad_content(self): + """ + Gets the content of the pad used to edit the task description + and returns it. + """ + self.ensure_one() + return self.pad_get_content(self.description_pad) + class ProjectProject(models.Model): _inherit = "project.project" - use_pads = fields.Boolean("Use collaborative pads", default=True, help="Use collaborative pad for the tasks on this project.") + use_pads = fields.Boolean("Use collaborative pads", default=True, + help="Use collaborative pad for the tasks on this project.") + + pad_availability = fields.Selection([ + ('internal', 'Internal Users'), + ('portal', 'Portal Users') + ], compute='_compute_pad_availability', store=True, readonly=False, + string='Availability of collaborative pads', required=True, default='internal') + + @api.depends('use_pads', 'privacy_visibility') + def _compute_pad_availability(self): + for project in self: + if project.privacy_visibility != 'portal' or not project.use_pads: + project.pad_availability = 'internal' diff --git a/addons/pad_project/static/src/css/pad_project.css b/addons/pad_project/static/src/css/pad_project.css new file mode 100644 index 00000000000..90a8b3de2cb --- /dev/null +++ b/addons/pad_project/static/src/css/pad_project.css @@ -0,0 +1,10 @@ +.o_pad_project_container { + border: solid 1px #c4c4c4; + height:500px; + padding: 0.5rem; + -webkit-box-shadow: 0 5px 10px rgba(0,0,0,0.1); + -moz-box-shadow: 0 5px 10px rgba(0,0,0,0.1); + -ms-box-shadow: 0 5px 10px rgba(0,0,0,0.1); + -o-box-shadow: 0 5px 10px rgba(0,0,0,0.1); + box-shadow: 0 5px 10px rgba(0,0,0,0.1); +} diff --git a/addons/pad_project/views/project_portal_assets.xml b/addons/pad_project/views/project_portal_assets.xml new file mode 100644 index 00000000000..ef773412517 --- /dev/null +++ b/addons/pad_project/views/project_portal_assets.xml @@ -0,0 +1,8 @@ + + + + diff --git a/addons/pad_project/views/project_portal_templates.xml b/addons/pad_project/views/project_portal_templates.xml new file mode 100644 index 00000000000..6981aaf1430 --- /dev/null +++ b/addons/pad_project/views/project_portal_templates.xml @@ -0,0 +1,34 @@ + + +