Browse Source
[FIX][11.0][web_responsive] Chatter Position Read/Write permissions (#966)
Includes test.
pull/969/head
Jairo Llopis
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
31 additions and
2 deletions
-
web_responsive/models/inherited_res_users.py
-
web_responsive/static/src/js/web_responsive.js
-
web_responsive/tests/__init__.py
-
web_responsive/tests/test_res_users.py
-
web_responsive/views/inherited_view_users_form_simple_modif.xml
|
@ -11,3 +11,16 @@ class ResUsers(models.Model): |
|
|
('normal', 'Normal'), |
|
|
('normal', 'Normal'), |
|
|
('sided', 'Sided'), |
|
|
('sided', 'Sided'), |
|
|
], string="Chatter Position", default='normal') |
|
|
], string="Chatter Position", default='normal') |
|
|
|
|
|
|
|
|
|
|
|
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']) |
|
@ -10,7 +10,6 @@ odoo.define('web_responsive', function(require) { |
|
|
var core = require('web.core'); |
|
|
var core = require('web.core'); |
|
|
var config = require('web.config'); |
|
|
var config = require('web.config'); |
|
|
var ViewManager = require('web.ViewManager'); |
|
|
var ViewManager = require('web.ViewManager'); |
|
|
var Session = require('web.session'); |
|
|
|
|
|
|
|
|
|
|
|
Menu.include({ |
|
|
Menu.include({ |
|
|
|
|
|
|
|
|
|
@ -1 +1,2 @@ |
|
|
from . import test_ui |
|
|
from . import test_ui |
|
|
|
|
|
from . import test_res_users |
|
@ -0,0 +1,16 @@ |
|
|
|
|
|
# Copyright 2018 Alexandre Díaz |
|
|
|
|
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
|
|
|
|
|
|
|
|
|
|
|
from odoo.tests import common |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestResUsers(common.TransactionCase): |
|
|
|
|
|
|
|
|
|
|
|
def test_chatter_position_wr(self): |
|
|
|
|
|
user_public = self.env.ref('base.public_user') |
|
|
|
|
|
|
|
|
|
|
|
self.assertEqual(user_public.chatter_position, 'normal') |
|
|
|
|
|
user_public.sudo(user_public).write({ |
|
|
|
|
|
'chatter_position': 'sided', |
|
|
|
|
|
}) |
|
|
|
|
|
self.assertEqual(user_public.chatter_position, 'sided') |
|
@ -13,7 +13,7 @@ |
|
|
<field name="inherit_id" ref="base.view_users_form_simple_modif" /> |
|
|
<field name="inherit_id" ref="base.view_users_form_simple_modif" /> |
|
|
<field name="arch" type="xml"> |
|
|
<field name="arch" type="xml"> |
|
|
<xpath expr="//field[@name='email']" position="after"> |
|
|
<xpath expr="//field[@name='email']" position="after"> |
|
|
<field name="chatter_position" /> |
|
|
|
|
|
|
|
|
<field name="chatter_position" readonly="0" /> |
|
|
</xpath> |
|
|
</xpath> |
|
|
</field> |
|
|
</field> |
|
|
</record> |
|
|
</record> |
|
|