black, isort

pull/1819/head
Alexandre Díaz 2019-10-13 23:41:25 +02:00 committed by Splash
parent a343941902
commit 6a722d815b
3 changed files with 20 additions and 30 deletions

View File

@ -8,22 +8,14 @@
"version": "13.0.1.0.0",
"category": "Website",
"website": "https://github.com/OCA/web",
"author": "LasLabs, Tecnativa, "
"Odoo Community Association (OCA)",
"author": "LasLabs, Tecnativa, " "Odoo Community Association (OCA)",
"license": "LGPL-3",
"installable": True,
"depends": [
'web',
'mail',
],
"data": [
'views/assets.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',
"depends": ["web", "mail"],
"data": ["views/assets.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",
],
}

View File

@ -1,16 +1,17 @@
# Copyright 2018-2019 Alexandre Díaz
# 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):
_inherit = 'res.users'
_inherit = "res.users"
chatter_position = fields.Selection([
('normal', 'Normal'),
('sided', 'Sided'),
], string="Chatter Position", default='sided')
chatter_position = fields.Selection(
[("normal", "Normal"), ("sided", "Sided")],
string="Chatter Position",
default="sided",
)
def __init__(self, pool, cr):
""" Override of __init__ to add access rights.
@ -20,7 +21,7 @@ class ResUsers(models.Model):
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'])
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'])
type(self).SELF_READABLE_FIELDS.extend(["chatter_position"])

View File

@ -5,12 +5,9 @@ from odoo.tests import common
class TestResUsers(common.TransactionCase):
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')
user_public.sudo(user_public).write({
'chatter_position': 'normal',
})
self.assertEqual(user_public.chatter_position, 'normal')
self.assertEqual(user_public.chatter_position, "sided")
user_public.sudo(user_public).write({"chatter_position": "normal"})
self.assertEqual(user_public.chatter_position, "normal")