details: https://code.tryton.org/tryton/commit/98ec77e46af7
branch: default
user: Cédric Krier <[email protected]>
date: Fri Sep 04 22:07:25 2026 +0200
description:
Add companies and employees to the user context
This allows to use the context for domain to restrict to allowed
companies and
employees.
diffstat:
modules/company/CHANGELOG | 1 +
modules/company/res.py | 11 ++---------
2 files changed, 3 insertions(+), 9 deletions(-)
diffs (37 lines):
diff -r 6f4a8415d5d5 -r 98ec77e46af7 modules/company/CHANGELOG
--- a/modules/company/CHANGELOG Sat Sep 19 10:03:57 2026 +0200
+++ b/modules/company/CHANGELOG Fri Sep 04 22:07:25 2026 +0200
@@ -1,3 +1,4 @@
+* Add companies and employees to the user context
Version 8.0.0 - 2026-04-20
--------------------------
diff -r 6f4a8415d5d5 -r 98ec77e46af7 modules/company/res.py
--- a/modules/company/res.py Sat Sep 19 10:03:57 2026 +0200
+++ b/modules/company/res.py Fri Sep 04 22:07:25 2026 +0200
@@ -85,7 +85,9 @@
def __setup__(cls):
super().__setup__()
cls._context_fields.insert(0, 'company')
+ cls._context_fields.insert(0, 'companies')
cls._context_fields.insert(0, 'employee')
+ cls._context_fields.insert(0, 'employees')
cls._context_fields.insert(0, 'company_filter')
@classmethod
@@ -149,15 +151,6 @@
self.employee, = employees
@classmethod
- def _get_preferences(cls, user, context_only=False):
- res = super()._get_preferences(user,
- context_only=context_only)
- if not context_only:
- res['companies'] = [c.id for c in user.companies]
- res['employees'] = [e.id for e in user.employees]
- return res
-
- @classmethod
def get_companies(cls):
'''
Return an ordered tuple of company ids for the user