From 9e640373587dea1e612b34eca6308cb42458b714 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 24 Oct 2022 12:01:57 +0700 Subject: Update __init__.py, __manifest__.py, and 21 more files... --- ob_chatter_position/models/res_users.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 ob_chatter_position/models/res_users.py (limited to 'ob_chatter_position/models/res_users.py') 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 -- cgit v1.2.3