Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions user_threshold/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Contributors
------------

* Ted Salmon <tsalmon@laslabs.com>
* Dave Lasley <dave@laslabs.com>


Maintainer
Expand Down
2 changes: 1 addition & 1 deletion user_threshold/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "User Threshold",
"summary": "Add Configurable User Threshold Support",
"version": "10.0.1.0.0",
"version": "10.0.1.0.1",
"category": "Authentication",
"website": "https://www.laslabs.com",
"author": "LasLabs, Odoo Community Association (OCA)",
Expand Down
32 changes: 15 additions & 17 deletions user_threshold/models/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from csv import reader
from lxml import etree

from odoo import SUPERUSER_ID, _, api, fields, models, registry
from odoo import SUPERUSER_ID, _, api, fields, models
from odoo.exceptions import AccessError, ValidationError

from .ir_config_parameter import THRESHOLD_HIDE, MAX_DB_USER_PARAM
Expand All @@ -29,23 +29,21 @@ def __init__(self, pool, cr):
exempt_users_var = os.environ.get('USER_THRESHOLD_USER', '')
exempt_users = reader([exempt_users_var])
with api.Environment.manage():
with registry(cr.dbname).cursor() as new_cr:
new_env = api.Environment(new_cr, SUPERUSER_ID, {})
installed = new_env['ir.module.module'].search_count([
('name', '=', 'user_threshold'),
('state', '=', 'installed'),
env = api.Environment(cr, SUPERUSER_ID, {})
installed = env['ir.module.module'].search_count([
('name', '=', 'user_threshold'),
('state', '=', 'installed'),
])
if installed:
users = env['res.users'].search([
('share', '=', False),
('threshold_exempt', '=', True),
])
if installed:
users = new_env['res.users'].search([
('share', '=', False),
('threshold_exempt', '=', True),
])
non_ex = users.filtered(
lambda r: r.login not in exempt_users
)
for user in non_ex:
user.threshold_exempt = False
new_cr.commit()
non_ex = users.filtered(
lambda r: r.login not in exempt_users
)
for user in non_ex:
user.threshold_exempt = False

def _check_thresholds(self):
"""
Expand Down