Files
app-odoo/app_chatgpt/models/res_users.py
2023-09-08 23:49:14 +08:00

17 lines
810 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
from odoo import fields, models
class ResUsers(models.Model):
_inherit = "res.users"
# 改为在 partner中设置用户处绑定
gpt_id = fields.Many2one('ai.robot', string='Bind to Ai', related='partner_id.gpt_id', inherited=True, readonly=False)
gpt_policy = fields.Selection([
('all', 'All Users'),
('limit', 'Selected Users')
], string='Allowed Conversation Mode', default='all', ondelete='set default')
gpt_wl_partners = fields.Many2many('res.partner', 'res_partner_ai_use', 'ai_user_id', 'name', string='Allowed Partners')
gpt_demo_time = fields.Integer('Default Demo Time', default=0)
is_chat_private = fields.Boolean('Allow Chat Private', default=False, related='partner_id.is_chat_private', inherited=True, readonly=False)