diff --git a/setup/web_chatter_position/odoo/addons/web_chatter_position b/setup/web_chatter_position/odoo/addons/web_chatter_position new file mode 120000 index 000000000000..e34df916dd81 --- /dev/null +++ b/setup/web_chatter_position/odoo/addons/web_chatter_position @@ -0,0 +1 @@ +../../../../web_chatter_position \ No newline at end of file diff --git a/setup/web_chatter_position/setup.py b/setup/web_chatter_position/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/web_chatter_position/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/web_chatter_position/README.rst b/web_chatter_position/README.rst new file mode 100644 index 000000000000..c59e3b75af19 --- /dev/null +++ b/web_chatter_position/README.rst @@ -0,0 +1,92 @@ +================ +Chatter Position +================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:2782ad5d52165f39314863ff4ef9384b26f5d9fc5507bbd41fd5e0f5df81e191 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/14.0/web_chatter_position + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-14-0/web-14-0-web_chatter_position + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=14.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Configurable Chatter Position. +Change Chatter Position in User Preferences. +Change Chatter Position on the fly. +Supports Both Community & Enterprise Edition. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +#. There's a **Chatter Position** option in **User Preferences**, where you can choose between "bottom" and "sided". +#. The position can also be changed on the fly using a new button on the top left side of Form Views. + +Known issues / Roadmap +====================== + +* This module implements the same feature as **web_responsive**. Once the enterprise interface is moved to community in version 16, only this module will be needed. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Hynsys Technologies +* Camptocamp + +Contributors +~~~~~~~~~~~~ + +* Hynsys Technologies +* Juan Miguel Sánchez Arce + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_chatter_position/__init__.py b/web_chatter_position/__init__.py new file mode 100644 index 000000000000..0650744f6bc6 --- /dev/null +++ b/web_chatter_position/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/web_chatter_position/__manifest__.py b/web_chatter_position/__manifest__.py new file mode 100644 index 000000000000..e047684f39ca --- /dev/null +++ b/web_chatter_position/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2022 Hynsys Technologies +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +{ + "name": "Chatter Position", + "summary": "Add an option to change the chatter position", + "version": "14.0.1.0.0", + "author": "Hynsys Technologies, Camptocamp, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/web", + "license": "LGPL-3", + "category": "Extra Tools", + "images": ["static/description/images/web_chatter_position.png"], + "depends": ["web", "mail"], + "data": ["views/res_users.xml", "views/web.xml", "views/assets.xml"], + "qweb": ["static/src/xml/form_buttons.xml"], + "installable": True, + "auto_install": False, +} diff --git a/web_chatter_position/i18n/web_chatter_position.pot b/web_chatter_position/i18n/web_chatter_position.pot new file mode 100644 index 000000000000..a09d5bfa6f06 --- /dev/null +++ b/web_chatter_position/i18n/web_chatter_position.pot @@ -0,0 +1,34 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_chatter_position +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: web_chatter_position +#: model:ir.model.fields.selection,name:web_chatter_position.selection__res_users__chatter_position__bottom +msgid "Bottom" +msgstr "" + +#. module: web_chatter_position +#: model:ir.model.fields,field_description:web_chatter_position.field_res_users__chatter_position +msgid "Chatter Position" +msgstr "" + +#. module: web_chatter_position +#: model:ir.model.fields.selection,name:web_chatter_position.selection__res_users__chatter_position__sided +msgid "Sided" +msgstr "" + +#. module: web_chatter_position +#: model:ir.model,name:web_chatter_position.model_res_users +msgid "Users" +msgstr "" diff --git a/web_chatter_position/models/__init__.py b/web_chatter_position/models/__init__.py new file mode 100644 index 000000000000..8835165330f8 --- /dev/null +++ b/web_chatter_position/models/__init__.py @@ -0,0 +1 @@ +from . import res_users diff --git a/web_chatter_position/models/res_users.py b/web_chatter_position/models/res_users.py new file mode 100644 index 000000000000..eab701782409 --- /dev/null +++ b/web_chatter_position/models/res_users.py @@ -0,0 +1,27 @@ +# Copyright 2022 Hynsys Technologies +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from odoo import fields, models + + +class ResUsers(models.Model): + _inherit = "res.users" + + chatter_position = fields.Selection( + [("bottom", "Bottom"), ("sided", "Sided")], + default="sided", + string="Chatter Position", + ) + + def __init__(self, pool, cr): + """Override of __init__ to add access rights. + Access rights are disabled by default, but allowed on some specific + fields defined in self.SELF_{READ/WRITE}ABLE_FIELDS. + """ + super(ResUsers, self).__init__(pool, cr) + # duplicate list to avoid modifying the original reference + type(self).SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS) + type(self).SELF_WRITEABLE_FIELDS.extend(["chatter_position"]) + # duplicate list to avoid modifying the original reference + type(self).SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS) + type(self).SELF_READABLE_FIELDS.extend(["chatter_position"]) diff --git a/web_chatter_position/readme/CONTRIBUTORS.rst b/web_chatter_position/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..dbc15218df33 --- /dev/null +++ b/web_chatter_position/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Hynsys Technologies +* Juan Miguel Sánchez Arce diff --git a/web_chatter_position/readme/DESCRIPTION.rst b/web_chatter_position/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..5c803862a119 --- /dev/null +++ b/web_chatter_position/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +Configurable Chatter Position. +Change Chatter Position in User Preferences. +Change Chatter Position on the fly. +Supports Both Community & Enterprise Edition. diff --git a/web_chatter_position/readme/ROADMAP.rst b/web_chatter_position/readme/ROADMAP.rst new file mode 100644 index 000000000000..c3d019c98d93 --- /dev/null +++ b/web_chatter_position/readme/ROADMAP.rst @@ -0,0 +1 @@ +* This module implements the same feature as **web_responsive**. Once the enterprise interface is moved to community in version 16, only this module will be needed. diff --git a/web_chatter_position/readme/USAGE.rst b/web_chatter_position/readme/USAGE.rst new file mode 100644 index 000000000000..605b46026227 --- /dev/null +++ b/web_chatter_position/readme/USAGE.rst @@ -0,0 +1,2 @@ +#. There's a **Chatter Position** option in **User Preferences**, where you can choose between "bottom" and "sided". +#. The position can also be changed on the fly using a new button on the top left side of Form Views. diff --git a/web_chatter_position/static/description/icon.png b/web_chatter_position/static/description/icon.png new file mode 100644 index 000000000000..3a0328b516c4 Binary files /dev/null and b/web_chatter_position/static/description/icon.png differ diff --git a/web_chatter_position/static/description/index.html b/web_chatter_position/static/description/index.html new file mode 100644 index 000000000000..b10ad1f70ab1 --- /dev/null +++ b/web_chatter_position/static/description/index.html @@ -0,0 +1,444 @@ + + + + + + +Chatter Position + + + +
+

Chatter Position

+ + +

Beta License: LGPL-3 OCA/web Translate me on Weblate Try me on Runboat

+

Configurable Chatter Position. +Change Chatter Position in User Preferences. +Change Chatter Position on the fly. +Supports Both Community & Enterprise Edition.

+

Table of contents

+ +
+

Usage

+
    +
  1. There’s a Chatter Position option in User Preferences, where you can choose between “bottom” and “sided”.
  2. +
  3. The position can also be changed on the fly using a new button on the top left side of Form Views.
  4. +
+
+
+

Known issues / Roadmap

+
    +
  • This module implements the same feature as web_responsive. Once the enterprise interface is moved to community in version 16, only this module will be needed.
  • +
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Hynsys Technologies
  • +
  • Camptocamp
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/web project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/web_chatter_position/static/src/js/form_chatter_position.js b/web_chatter_position/static/src/js/form_chatter_position.js new file mode 100644 index 000000000000..dbcb119f8820 --- /dev/null +++ b/web_chatter_position/static/src/js/form_chatter_position.js @@ -0,0 +1,48 @@ +// Copyright 2022 Hynsys Technologies +// License LGPL - 3.0 or later(http://www.gnu.org/licenses/lgpl). + +odoo.define("web_chatter_position.ChatterPositionFormController", function (require) { + "use strict"; + + var config = require("web.config"); + var FormController = require("web.FormController"); + var FormRenderer = require("web.FormRenderer"); + + var ChatterPositionFormController = FormController.include({ + renderButtons: function () { + this._super.apply(this, arguments); + if (this.$buttons) { + this.$buttons.on( + "click", + ".o_chatter_position_button", + this._onChatterPosition.bind(this) + ); + } + }, + + _onChatterPosition: function () { + if (this.$el.offsetParent().hasClass("o_chatter_position_bottom")) { + this.$el + .offsetParent() + .attr("class", "o_web_client o_chatter_position_sided"); + } else if (this.$el.offsetParent().hasClass("o_chatter_position_sided")) { + this.$el + .offsetParent() + .attr("class", "o_web_client o_chatter_position_bottom"); + } + }, + }); + + FormRenderer.include({ + _applyFormSizeClass: function () { + const formEl = this.$el[0]; + if (config.device.size_class <= config.device.SIZES.XS) { + formEl.classList.add("o_xxs_form_view"); + } else { + formEl.classList.remove("o_xxs_form_view"); + } + }, + }); + + return ChatterPositionFormController; +}); diff --git a/web_chatter_position/static/src/scss/attachment_viewer.scss b/web_chatter_position/static/src/scss/attachment_viewer.scss new file mode 100644 index 000000000000..874191c669b4 --- /dev/null +++ b/web_chatter_position/static/src/scss/attachment_viewer.scss @@ -0,0 +1,52 @@ +// Attachment Viewer +.o_web_client.o_chatter_position_sided .o_DialogManager_dialog { + /* Show sided viewer on large screens */ + @include media-breakpoint-up(lg) { + position: static; + .o_AttachmentViewer_main { + padding-bottom: 20px; + } + .o_AttachmentViewer { + // On-top of navbar + z-index: 10; + position: absolute; + right: 0; + top: 0; + bottom: 0; + margin-left: auto; + background-color: rgba(0, 0, 0, 0.7); + + width: $chatter_zone_width; + &.o_AttachmentViewer_maximized { + width: 100%; + } + + /* Show/Hide control buttons (next, prev, etc..) */ + &:hover .o_AttachmentViewer_buttonNavigation, + &:hover .o_AttachmentViewer_toolbar { + display: flex; + } + .o_AttachmentViewer_buttonNavigation, + .o_AttachmentViewer_toolbar { + display: none; + } + .o_AttachmentViewer_viewIframe { + width: 95%; + } + } + } + @include media-breakpoint-down(md) { + .o_AttachmentViewer_headerItemButtonMinimize, + .o_AttachmentViewer_headerItemButtonMaximize { + display: none; + } + } +} + +/* Attachment Viewer Max/Min buttons only are useful in sided mode */ +.o_web_client:not(.o_chatter_position_sided) { + .o_AttachmentViewer_headerItemButtonMinimize, + .o_AttachmentViewer_headerItemButtonMaximize { + display: none; + } +} diff --git a/web_chatter_position/static/src/scss/chatter_position.scss b/web_chatter_position/static/src/scss/chatter_position.scss new file mode 100644 index 000000000000..3cc8b1693122 --- /dev/null +++ b/web_chatter_position/static/src/scss/chatter_position.scss @@ -0,0 +1,355 @@ +$chatter_zone_width: 35%; +$o-form-view-sheet-max-width: 1140px !default; +// Size of labels +.o_web_client { + &.o_chatter_position_sided { + .o_action_manager { + .o_content, + .modal-content { + @include media-breakpoint-up(xl, $o-extra-grid-breakpoints) { + .o_inner_group { + .o_td_label { + min-width: 260px !important; + } + } + } + @include media-breakpoint-between(lg, xl, $o-extra-grid-breakpoints) { + .o_group_col_6 { + width: 100% !important; + } + } + } + } + } + &:not(.o_chatter_position_sided) { + @include media-breakpoint-up(lg, $o-extra-grid-breakpoints) { + .o_action_manager { + .o_content, + .modal-content { + .o_inner_group { + .o_td_label { + min-width: 260px !important; + } + } + } + } + } + } +} + +// Normal views +.o_content, +.modal-content { + max-width: 100%; + + // Form views + .o_form_view { + .o_form_sheet { + max-width: calc(100% - 32px); + overflow-x: auto; + } + + .o_td_label .o_form_label:not(.o_status):not(.o_calendar_invitation) { + min-height: 23px; + @include media-breakpoint-up(md) { + margin-bottom: 10px; + } + } + .o_horizontal_separator { + font-size: 14px; + } + // Some UX improvements for form in edit mode + @include media-breakpoint-down(sm) { + .o_field_widget { + vertical-align: middle; + } + &.o_form_editable .o_field_widget { + &:not(.o_stat_info):not(.o_readonly_modifier):not(.oe_form_field_html):not(.o_field_image) { + min-height: 35px; + } + .o_x2m_control_panel { + margin-bottom: 10px; + } + &.o_field_float_percentage, + &.o_field_monetary, + &.o_field_many2manytags, + .o_field_many2one_selection { + align-items: center; + } + .o_field_many2one_selection .o_input_dropdown, + &.o_datepicker, + &.o_field_partner_autocomplete { + input { + min-height: 35px; + } + } + .o_external_button { + margin-left: 10px; + } + .o_dropdown_button, + .o_datepicker_button { + top: 8px; + right: 6px; + bottom: auto; + } + } + } + + .o_FormRenderer_chatterContainer { + padding-top: 0; + .o_Activity_info { + flex-wrap: wrap; + } + .o_ActivityBox_title { + margin-bottom: 0; + } + .o_MessageList_separatorDate { + padding-bottom: 0; + } + } + // Sided chatter scrolling behavior + .o_Chatter { + height: fit-content; + .o_Chatter_fixedPanel { + position: sticky; + top: 0; + z-index: 1; + background-color: white; + padding-bottom: 10px; + } + .o_Chatter_scrollPanel { + overflow: initial; + } + } + + // Sticky statusbar + .o_form_statusbar { + position: sticky; + top: 0; + z-index: 2; + } + + // Support for long title (with ellipsis) + .oe_title { + span.o_field_widget:not(.oe_inline) { + max-width: 100%; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + width: initial; + &:active { + white-space: normal; + } + } + } + + @include media-breakpoint-down(sm) { + min-width: auto; + + // More buttons border + .oe_button_box { + .o_dropdown_more { + button:last-child { + border-right: 1px solid gray("400"); + } + } + } + + // Avoid overflow on forms with title and/or button box + .oe_title { + max-width: 100%; + } + + .oe_button_box + .oe_title, + .oe_button_box + .oe_avatar + .oe_title { + width: 100%; + } + + // Avoid overflow on modals + .o_form_sheet { + min-width: auto; + } + + // Render website inputs properly in phones + .o_group .o_field_widget.o_text_overflow { + // Overrides another !important + width: auto !important; + } + + // Make all input groups vertical + .o_group_col_6, + .o_group_col_8 { + width: 100%; + } + + // Statusbar buttons dropdown for mobiles + .o_statusbar_buttons_dropdown { + border: { + bottom: 0; + radius: 0; + top: 0; + } + height: 100%; + } + .o_statusbar_buttons.dropdown-menu { + .btn { + border-radius: 0; + border: 0; + width: 100%; + margin-bottom: 0.2rem; + white-space: nowrap; + @include media-breakpoint-down(xs) { + max-width: 80vw; + overflow: hidden; + text-overflow: ellipsis; + } + + &:last-child { + margin-bottom: 0; + } + } + } + + .o_statusbar_status { + // Arrow from rightmost button exceeds allowed width + .o_arrow_button:first-child::before { + content: none; + display: none; + } + } + + // Full width in form sheets + .o_form_sheet, + .o_FormRenderer_chatterContainer { + min-width: auto; + max-width: 98%; + } + + // Settings pages + .app_settings_block { + .row { + margin: 0; + } + } + + .o_FormRenderer_chatterContainer { + padding-top: initial; + + // Display send button on small screens + .o_Chatter_composer { + &.o-has-current-partner-avatar { + grid-template-columns: 0px 1fr; + padding: 1rem 1rem 1.5rem 1rem; + } + + .o_Composer_sidebarMain { + display: none; + } + } + } + } + } + + //No content message improvements on mobile + @include media-breakpoint-down(md) { + .o_view_nocontent { + top: 80px; + } + .o_nocontent_help { + box-shadow: none; + } + .o_sample_data_disabled { + display: none; + } + } + .o_chatter_position_bottom & { + .o_form_view { + flex-flow: column; + height: auto; + .o_form_sheet_bg { + width: 100%; + } + + .oe_chatter { + width: 100%; + padding: 16px 16px 48px; + } + } + } + // Sided chatter, if user wants + .o_chatter_position_sided & { + .o_chatter { + flex: 0 0 35%; + overflow: auto; + } + @include media-breakpoint-up(lg) { + .o_form_view:not(.o_form_nosheet) { + display: flex; + flex-flow: row nowrap; + height: 100%; + + .o_form_sheet_bg { + flex: 1 1 auto; + overflow: auto; + + > .o_form_sheet { + min-width: unset; + } + } + + .o_FormRenderer_chatterContainer { + border-left: 1px solid gray("400"); + flex: 0 0 $chatter_zone_width; + max-width: initial; + min-width: initial; + overflow: auto; + + .o_chatter_header_container { + padding-top: $grid-gutter-width * 0.5; + top: 0; + position: sticky; + background-color: $o-view-background-color; + z-index: 1; + + // Scrollable input text to avoid hide conversation & buttons + .o_composer_text_field { + max-height: 120px; + overflow-y: auto !important; /* Forced because Odoo uses inline style */ + } + .o_attachments_list { + overflow: auto; + max-height: $o-mail-attachment-image-size * 3; + margin-top: 0.4em; + } + .o_attachments_previews { + overflow: auto; + max-height: $o-mail-attachment-image-size * 6; + } + } + } + } + } + } +} +.o_FormRenderer_chatterContainer { + &.o-aside { + border-left: $border-width 0; + padding: map-get($spacers, 0); + width: $o-form-view-sheet-max-width !important; + + .o_Message.o-not-discussion { + border-width: $border-width 0; + } + } + + &.o-isInFormSheetBg:not(.o-aside) { + max-width: $o-form-view-sheet-max-width; + background-color: $white; + @include o-form-sheet-negative-margin; + + &:not(.o-aside) { + width: auto; + border-top: 1px solid $border-color; + } + } +} diff --git a/web_chatter_position/static/src/xml/form_buttons.xml b/web_chatter_position/static/src/xml/form_buttons.xml new file mode 100644 index 000000000000..07c534f52497 --- /dev/null +++ b/web_chatter_position/static/src/xml/form_buttons.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/web_chatter_position/views/assets.xml b/web_chatter_position/views/assets.xml new file mode 100644 index 000000000000..93ce3b125eef --- /dev/null +++ b/web_chatter_position/views/assets.xml @@ -0,0 +1,25 @@ + + +