summaryrefslogtreecommitdiff
path: root/addons/mail_bot/models/res_users.py
diff options
context:
space:
mode:
authorXavierDo <xdo@odoo.com>2018-08-13 18:49:19 +0200
committerXavierDo <xdo@odoo.com>2018-08-13 21:45:53 +0200
commit2df29bcfbdf8e754903b6ef3a0a7dddc00f61b08 (patch)
treec38ad750cb029e450b3a83ef0d8776fe26cb7966 /addons/mail_bot/models/res_users.py
parent9916e5bad3ed5eb77d2dadaa1d06949ec3b02347 (diff)
[IMP] mail_bot: make odoobot statefull
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.
Diffstat (limited to 'addons/mail_bot/models/res_users.py')
-rw-r--r--addons/mail_bot/models/res_users.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/addons/mail_bot/models/res_users.py b/addons/mail_bot/models/res_users.py
index 8c880b11a6e..2905e3d8f5e 100644
--- a/addons/mail_bot/models/res_users.py
+++ b/addons/mail_bot/models/res_users.py
@@ -5,5 +5,13 @@ from odoo import models, fields
class Users(models.Model):
_inherit = 'res.users'
-
- odoobot_initialized = fields.Boolean(readonly=True, default=False)
+ 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