The current implementation of odoobot is stateless, making him a little dummy. Adding a state on the user allow to be sure that the user don't skip a step, or loop back to a previous step. States also allows odoobot to repeat the question when the user don't give the right answer. A quick modification asked by FP before freeze, in order to change the field type in time.
18 lines
754 B
Python
18 lines
754 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import models, fields
|
|
|
|
class Users(models.Model):
|
|
_inherit = 'res.users'
|
|
odoobot_state = fields.Selection(
|
|
[
|
|
('not_initialized', 'Not initialized'),
|
|
('onboarding_emoji', 'Onboarding emoji'),
|
|
('onboarding_attachement', 'Onboarding attachement'),
|
|
('onboarding_command', 'Onboarding command'),
|
|
('onboarding_ping', 'Onboarding ping'),
|
|
('idle', 'Idle'),
|
|
('disabled', 'Disabled'),
|
|
], string="Odoobot Status", readonly=True, required=True, default="not_initialized") # keep track of the state: correspond to the code of the last message sent
|