[IMP] project: add chatter in project sharing form view

Before this commit, the chatter is not available in form view of project
sharing even for portal user. Since the portal views, we have a chatter
for the portal users, we need a chatter for those users in project
sharing.

This commit integrates the portal chatter in the form view for only the
portal users.

task-2379518

closes #73341
This commit is contained in:
Xavier BOL (xbo)
2021-08-26 14:59:33 +02:00
parent 2bbb038f22
commit 60e97e4ffb
5 changed files with 84 additions and 1 deletions
+5 -1
View File
@@ -100,13 +100,17 @@
# Remove Longpolling bus and packages needed this bus
('remove', 'bus/static/src/js/services/assets_watchdog_service.js'),
('remove', 'mail/static/src/services/messaging/messaging.js'),
('remove', 'mail/static/src/components/notification_request/notification_request.js'),
('remove', 'mail/static/src/components/dialog_manager/dialog_manager.js'),
('remove', 'mail/static/src/services/dialog_service/dialog_service.js'),
('remove', 'mail/static/src/components/chat_window_manager/chat_window_manager.js'),
('remove', 'mail/static/src/services/chat_window_service/chat_window_service.js'),
'web/static/src/legacy/js/public/public_widget.js',
'portal/static/src/js/portal_chatter.js',
'portal/static/src/js/portal_composer.js',
'project/static/src/project_sharing/**/*.js',
'project/static/src/scss/project_sharing/*',
'web/static/src/start.js',
'web/static/src/legacy/legacy_setup.js',
],
@@ -0,0 +1,32 @@
/** @odoo-module **/
import FormRenderer from 'web.FormRenderer';
import { PortalChatter } from 'portal.chatter';
export default FormRenderer.extend({
_makeChatterContainerComponent() {
const props = this._makeChatterContainerProps();
this._chatterContainerComponent = new PortalChatter(this, props);
},
_makeChatterContainerProps() {
return {
token: '',
res_model: 'project.task',
pid: '',
hash: '',
res_id: this.state.res_id,
pager_step: 10,
allow_composer: true,
two_columns: false,
};
},
_makeChatterContainerTarget() {
const $el = $('<div class="o_FormRenderer_chatterContainer"/>');
this._chatterContainerTarget = $el[0];
return $el;
},
_mountChatterContainerComponent() {
this._chatterContainerComponent.appendTo(this._chatterContainerTarget);
},
_updateChatterContainerComponent() {},
});
@@ -2,9 +2,11 @@
import FormView from 'web.FormView';
import Controller from './controller';
import Renderer from './renderer';
export default FormView.extend({
config: _.extend({}, FormView.prototype.config, {
Controller,
Renderer,
}),
});
@@ -0,0 +1,44 @@
.o_FormRenderer_chatterContainer {
display: flex;
background-color: $white;
border-color: $border-color;
height: fit-content;
.o_portal_chatter {
width: 100%;
.o_portal_chatter_header {
text-align: center;
vertical-align: middle;
}
div.o_portal_chatter_composer,
div.o_portal_chatter_messages {
div.media {
gap: 10px;
.o_portal_chatter_attachments {
margin-bottom: 1rem;
}
}
}
}
&.o-aside {
flex-direction: column;
.o_portal_chatter {
.o_portal_chatter_header {
padding-top: 1rem;
padding-bottom: 2px;
}
.o_portal_chatter_composer, .o_portal_chatter_messages {
margin-left: 1rem;
margin-right: 1rem;
}
}
}
}
@@ -194,6 +194,7 @@
</page>
</notebook>
</sheet>
<div class="oe_chatter"/>
</form>
</field>
</record>