forked from Techsystech/web
black, isort
parent
0de0fa4a81
commit
163671220b
|
@ -8,22 +8,14 @@
|
||||||
"version": "13.0.1.0.0",
|
"version": "13.0.1.0.0",
|
||||||
"category": "Website",
|
"category": "Website",
|
||||||
"website": "https://github.com/OCA/web",
|
"website": "https://github.com/OCA/web",
|
||||||
"author": "LasLabs, Tecnativa, "
|
"author": "LasLabs, Tecnativa, " "Odoo Community Association (OCA)",
|
||||||
"Odoo Community Association (OCA)",
|
|
||||||
"license": "LGPL-3",
|
"license": "LGPL-3",
|
||||||
"installable": True,
|
"installable": True,
|
||||||
"depends": [
|
"depends": ["web", "mail"],
|
||||||
'web',
|
"data": ["views/assets.xml", "views/res_users.xml", "views/web.xml"],
|
||||||
'mail',
|
"qweb": [
|
||||||
],
|
"static/src/xml/apps.xml",
|
||||||
"data": [
|
"static/src/xml/form_view.xml",
|
||||||
'views/assets.xml',
|
"static/src/xml/navbar.xml",
|
||||||
'views/res_users.xml',
|
|
||||||
'views/web.xml',
|
|
||||||
],
|
|
||||||
'qweb': [
|
|
||||||
'static/src/xml/apps.xml',
|
|
||||||
'static/src/xml/form_view.xml',
|
|
||||||
'static/src/xml/navbar.xml',
|
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
# Copyright 2018-2019 Alexandre Díaz
|
# Copyright 2018-2019 Alexandre Díaz
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import models, fields
|
from odoo import fields, models
|
||||||
|
|
||||||
|
|
||||||
class ResUsers(models.Model):
|
class ResUsers(models.Model):
|
||||||
_inherit = 'res.users'
|
_inherit = "res.users"
|
||||||
|
|
||||||
chatter_position = fields.Selection([
|
chatter_position = fields.Selection(
|
||||||
('normal', 'Normal'),
|
[("normal", "Normal"), ("sided", "Sided")],
|
||||||
('sided', 'Sided'),
|
string="Chatter Position",
|
||||||
], string="Chatter Position", default='sided')
|
default="sided",
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, pool, cr):
|
def __init__(self, pool, cr):
|
||||||
""" Override of __init__ to add access rights.
|
""" Override of __init__ to add access rights.
|
||||||
|
@ -20,7 +21,7 @@ class ResUsers(models.Model):
|
||||||
super(ResUsers, self).__init__(pool, cr)
|
super(ResUsers, self).__init__(pool, cr)
|
||||||
# duplicate list to avoid modifying the original reference
|
# duplicate list to avoid modifying the original reference
|
||||||
type(self).SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS)
|
type(self).SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS)
|
||||||
type(self).SELF_WRITEABLE_FIELDS.extend(['chatter_position'])
|
type(self).SELF_WRITEABLE_FIELDS.extend(["chatter_position"])
|
||||||
# duplicate list to avoid modifying the original reference
|
# duplicate list to avoid modifying the original reference
|
||||||
type(self).SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS)
|
type(self).SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS)
|
||||||
type(self).SELF_READABLE_FIELDS.extend(['chatter_position'])
|
type(self).SELF_READABLE_FIELDS.extend(["chatter_position"])
|
||||||
|
|
|
@ -5,12 +5,9 @@ from odoo.tests import common
|
||||||
|
|
||||||
|
|
||||||
class TestResUsers(common.TransactionCase):
|
class TestResUsers(common.TransactionCase):
|
||||||
|
|
||||||
def test_chatter_position_wr(self):
|
def test_chatter_position_wr(self):
|
||||||
user_public = self.env.ref('base.public_user')
|
user_public = self.env.ref("base.public_user")
|
||||||
|
|
||||||
self.assertEqual(user_public.chatter_position, 'sided')
|
self.assertEqual(user_public.chatter_position, "sided")
|
||||||
user_public.sudo(user_public).write({
|
user_public.sudo(user_public).write({"chatter_position": "normal"})
|
||||||
'chatter_position': 'normal',
|
self.assertEqual(user_public.chatter_position, "normal")
|
||||||
})
|
|
||||||
self.assertEqual(user_public.chatter_position, 'normal')
|
|
||||||
|
|
Loading…
Reference in New Issue