Tryton module to add values to context of ir.rule.
Project description
mds-irrulecontext
Tryton module to add values to context of ir.rule.
Install
pip install mds-irrulecontext
How To
Add your model_names using _context_modelnames(), the module will then add the value user_id to the context of ir.rule. If company is installed, the ID of company and employee will be in the context. Use _get_context_values() to add additional values to context of ir.rule:
class IrRule(metaclass=PoolMeta):
__name__ = 'ir.rule'
@classmethod
def _context_modelnames(cls):
""" add model_name to context
"""
result = super(IrRule, cls)._context_modelnames()
result |= {'modelname1', 'modelname2'}
return result
@classmethod
def _get_context_values(cls, model_name):
""" add values to context
"""
result = super(IrRule, cls)._get_context_values(model_name)
if model_name == 'modelname1':
result['key1'] = 'value1'
elif model_name == 'modelname2':
result['key2'] = 'value2'
return result
Requires
Tryton 7.0
Changes
7.0.1 - 05.07.2024
works
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mds_irrulecontext-7.0.1.tar.gz.
File metadata
- Download URL: mds_irrulecontext-7.0.1.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0581796e6b2e49f76eb6db917bc50983892749ec913e41b7dd310fba814c9a0e
|
|
| MD5 |
ff1f1a21979698c6c72fdc6b2f580f60
|
|
| BLAKE2b-256 |
3340b4c0d7ffabb53db7fcff41ee2b0dbfc624802e8fbdce3b41d0d7a8a44ff2
|
File details
Details for the file mds_irrulecontext-7.0.1-py3-none-any.whl.
File metadata
- Download URL: mds_irrulecontext-7.0.1-py3-none-any.whl
- Upload date:
- Size: 20.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b89060e0b12ca94580e60aefe1e1f10db3add65bbfd175c9c1a2797a72c669e9
|
|
| MD5 |
b6ac084a32ad93c19ce41563a0079da0
|
|
| BLAKE2b-256 |
dd6cc0e1a9c42a0d667a55f715e2bfd19a50967261507b6c3a23763fbd345ba0
|