~opencrea/+junk/helpdesk

« back to all changes in this revision

Viewing changes to web_responsive/models/res_users.py

  • Committer: joannes
  • Date: 2019-10-22 08:35:02 UTC
  • Revision ID: joannes@debian-20191022083502-mt30yw9vxj0jkkwi
init

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2018 Alexandre Díaz
 
2
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
 
3
 
 
4
from odoo import models, fields
 
5
 
 
6
 
 
7
class ResUsers(models.Model):
 
8
    _inherit = 'res.users'
 
9
 
 
10
    chatter_position = fields.Selection([
 
11
        ('normal', 'Normal'),
 
12
        ('sided', 'Sided'),
 
13
    ], string="Chatter Position", default='normal')
 
14
 
 
15
    def __init__(self, pool, cr):
 
16
        """ Override of __init__ to add access rights.
 
17
        Access rights are disabled by default, but allowed on some specific
 
18
        fields defined in self.SELF_{READ/WRITE}ABLE_FIELDS.
 
19
        """
 
20
        super(ResUsers, self).__init__(pool, cr)
 
21
        # duplicate list to avoid modifying the original reference
 
22
        type(self).SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS)
 
23
        type(self).SELF_WRITEABLE_FIELDS.extend(['chatter_position'])
 
24
        # duplicate list to avoid modifying the original reference
 
25
        type(self).SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS)
 
26
        type(self).SELF_READABLE_FIELDS.extend(['chatter_position'])