mirror of
https://github.com/bringout/oca-ocb-web.git
synced 2026-04-22 10:12:01 +02:00
19.0 vanilla
This commit is contained in:
parent
20e6dadd87
commit
4b94f0abc5
205 changed files with 24700 additions and 14614 deletions
18
odoo-bringout-oca-ocb-web_tour/web_tour/models/res_users.py
Normal file
18
odoo-bringout-oca-ocb-web_tour/web_tour/models/res_users.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
from odoo import models, fields, api, modules
|
||||
|
||||
|
||||
class ResUsers(models.Model):
|
||||
_inherit = "res.users"
|
||||
|
||||
tour_enabled = fields.Boolean(compute='_compute_tour_enabled', store=True, readonly=False, string="Onboarding")
|
||||
|
||||
@api.depends("create_date")
|
||||
def _compute_tour_enabled(self):
|
||||
demo_modules_count = self.env['ir.module.module'].sudo().search_count([('demo', '=', True)])
|
||||
for user in self:
|
||||
user.tour_enabled = user._is_admin() and demo_modules_count == 0 and not modules.module.current_test
|
||||
|
||||
@api.model
|
||||
def switch_tour_enabled(self, val):
|
||||
self.env.user.sudo().tour_enabled = val
|
||||
return self.env.user.tour_enabled
|
||||
Loading…
Add table
Add a link
Reference in a new issue