diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-10-24 12:01:57 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-10-24 12:01:57 +0700 |
| commit | 9e640373587dea1e612b34eca6308cb42458b714 (patch) | |
| tree | 5222b900daef5a6eafceeed7c572c715891ae620 /ob_chatter_position/models | |
| parent | 2b3c94874466c3dd0a05f0f81dd4b09bc3f87987 (diff) | |
Update __init__.py, __manifest__.py, and 21 more files...
Diffstat (limited to 'ob_chatter_position/models')
| -rwxr-xr-x | ob_chatter_position/models/__init__.py | 2 | ||||
| -rwxr-xr-x | ob_chatter_position/models/res_users.py | 25 |
2 files changed, 27 insertions, 0 deletions
diff --git a/ob_chatter_position/models/__init__.py b/ob_chatter_position/models/__init__.py new file mode 100755 index 0000000..741ed46 --- /dev/null +++ b/ob_chatter_position/models/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import res_users diff --git a/ob_chatter_position/models/res_users.py b/ob_chatter_position/models/res_users.py new file mode 100755 index 0000000..fab83a7 --- /dev/null +++ b/ob_chatter_position/models/res_users.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +from odoo import fields, models + + +class ResUsers(models.Model): + _inherit = "res.users" + + chatter_position = fields.Selection( + [("normal", "Normal"), ("sided", "Sided")], + default="sided", + ) + + # Override so that the user can change the chatter_position field + + def __init__(self, pool, cr): + """ Override of init to allow user to set its chatter position. """ + init_res = 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_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS) + type(self).SELF_READABLE_FIELDS.extend(['chatter_position']) + return init_res |
