Files
odoo_source/addons/pad_project/views/project_portal_templates.xml
T
Rémy Baranx (bar) 11cd84317d [IMP] pad_project: collaborative pads in portal
When the 'collaborative pads' option is activated for a project,
and the visibility is set to 'portal users', it is possible to define
the access level to pads to edit task descriptions.

- If set to 'internal users', the behavior stays the same.
- If set to 'portal users', a portal user has access to a pad to edit
  task descriptions on the portal.

When configured for portal users access, by default, the task description
is displayed with an 'edit' button on top of it.

On 'edit' button click, the page is re-rendered with an additional
url parmater 'edit=1' to switch to edit mode.

In edit mode, the task description is shown in a collaborative pad,
with a 'Save' button on top of it.

On 'save' button click, the page is re-rendered with the 'edit' url
parameter, to switch in classic mode (read-only).

TaskID: 2204379

[IMP] project: collaborative pads in portal

In order to be (easily) able to add buttons to the right of the description
title, the description title is put inside a d-flex div.

closes odoo/odoo#46591

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-03-19 14:33:02 +00:00

35 lines
1.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_my_task" inherit_id="project.portal_my_task" priority="40">
<!-- add a button to the right of the 'description' title according to the mode (edit/read) -->
<xpath expr="//div[@t-if='task.description']//div[hasclass('d-flex')]" position="inside">
<t t-if="task._use_portal_pad()">
<t t-if="request.params.get('edit')">
<a role="button" class="btn btn-primary btn-sm ml-auto" t-attf-href="/my/task/#{task.id}">Save</a>
</t>
<t t-else="">
<a role="button" class="btn btn-primary btn-sm ml-auto" t-attf-href="/my/task/#{task.id}?edit=1">Edit</a>
</t>
</t>
</xpath>
<!-- show the description (read mode) or a pad (edit mode) -->
<xpath expr="//div[@t-field='task.description']" position="replace">
<t t-if="task._use_portal_pad()">
<t t-if="request.params.get('edit')">
<div class="o_pad_project_container">
<iframe width="100%" height="100%" frameborder="0" t-att-src="task.description_pad + '?showChat=false&amp;userName=' + request.env.user.name"/>
</div>
</t>
<t t-else="">
<div class="py-1 px-2 bg-100 small" t-raw="task._get_pad_content()"/>
</t>
</t>
<t t-else="">
<t>$0</t>
</t>
</xpath>
</template>
</odoo>