3
0
Fork 0

[MIG] web_chatter_position: Migration to 13.0

13.0
SergiCForgeFlow 2023-07-18 13:53:28 +02:00
parent a71ba65d19
commit 8c067155ae
5 changed files with 61 additions and 29 deletions

View File

@ -4,22 +4,15 @@
{
"name": "Chatter Position",
"summary": "Add an option to change the chatter position",
"version": "15.0.1.0.0",
"version": "13.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"],
"assets": {
"web.assets_backend": [
"/web_chatter_position/static/src/scss/chatter_position.scss",
"/web_chatter_position/static/src/scss/attachment_viewer.scss",
"/web_chatter_position/static/src/js/form_chatter_position.js",
],
"web.assets_qweb": ["/web_chatter_position/static/src/xml/form_buttons.xml"],
},
"data": ["views/res_users.xml", "views/web.xml", "views/assets.xml"],
"qweb": ["static/src/xml/form_buttons.xml"],
"installable": True,
"auto_install": False,
}

View File

@ -8,15 +8,20 @@ class ResUsers(models.Model):
_inherit = "res.users"
chatter_position = fields.Selection(
[("bottom", "Bottom"), ("sided", "Sided")], default="sided",
[("bottom", "Bottom"), ("sided", "Sided")],
default="sided",
string="Chatter Position",
)
# Override so that the user can change the chatter_position field
@property
def SELF_READABLE_FIELDS(self):
return super().SELF_READABLE_FIELDS + ["chatter_position"]
@property
def SELF_WRITEABLE_FIELDS(self):
return super().SELF_WRITEABLE_FIELDS + ["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"])

View File

@ -1,5 +1,5 @@
$chatter_zone_width: 35%;
$o-form-view-sheet-max-width: 1140px !default;
// Size of labels
.o_web_client {
&.o_chatter_position_sided {
@ -262,9 +262,26 @@ $chatter_zone_width: 35%;
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;

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template
id="assets_backend"
name="Open Mobile Assets"
inherit_id="web.assets_backend"
>
<xpath expr=".">
<link
type="text/css"
rel="stylesheet"
href="/web_chatter_position/static/src/scss/chatter_position.scss"
/>
<link
type="text/css"
rel="stylesheet"
href="/web_chatter_position/static/src/scss/attachment_viewer.scss"
/>
<script
type="application/javascript"
src="/web_chatter_position/static/src/js/form_chatter_position.js"
/>
</xpath>
</template>
</odoo>

View File

@ -9,12 +9,4 @@
/>
</xpath>
</template>
<template id="view_web_layout" inherit_id="web.layout" name="View Layout">
<xpath expr="//meta[last()]" position="after">
<meta
name="viewport"
content="width=device-width, initial-scale=1, user-scalable=no"
/>
</xpath>
</template>
</odoo>