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
Raw data
{
"_id": null,
"home_page": "https://www.m-ds.de/",
"name": "mds-irrulecontext",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "tryton context rule",
"author": "martin-data services",
"author_email": "service@m-ds.de",
"download_url": "https://files.pythonhosted.org/packages/33/40/b4c0d7ffabb53db7fcff41ee2b0dbfc624802e8fbdce3b41d0d7a8a44ff2/mds_irrulecontext-7.0.1.tar.gz",
"platform": null,
"description": "mds-irrulecontext\n=================\nTryton module to add values to context of ir.rule.\n\nInstall\n=======\n\npip install mds-irrulecontext\n\nHow To\n======\n\nAdd your ``model_names`` using *_context_modelnames()*, the module will then add the\nvalue ``user_id`` to the context of ir.rule. If *company* is installed, the ``ID`` of\n``company`` and ``employee`` will be in the context. Use *_get_context_values()* to\nadd additional values to context of ir.rule::\n\n class IrRule(metaclass=PoolMeta):\n __name__ = 'ir.rule'\n\n @classmethod\n def _context_modelnames(cls):\n \"\"\" add model_name to context\n \"\"\"\n result = super(IrRule, cls)._context_modelnames()\n result |= {'modelname1', 'modelname2'}\n return result\n\n @classmethod\n def _get_context_values(cls, model_name):\n \"\"\" add values to context\n \"\"\"\n result = super(IrRule, cls)._get_context_values(model_name)\n\n if model_name == 'modelname1':\n result['key1'] = 'value1'\n elif model_name == 'modelname2':\n result['key2'] = 'value2'\n return result\n\n\nRequires\n========\n- Tryton 7.0\n\n\nChanges\n=======\n\n*7.0.1 - 05.07.2024*\n\n- works\n\n\n",
"bugtrack_url": null,
"license": "GPL-3",
"summary": "Tryton module to add values to context of ir.rule.",
"version": "7.0.1",
"project_urls": {
"Homepage": "https://www.m-ds.de/"
},
"split_keywords": [
"tryton",
"context",
"rule"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "dd6cc0e1a9c42a0d667a55f715e2bfd19a50967261507b6c3a23763fbd345ba0",
"md5": "b6ac084a32ad93c19ce41563a0079da0",
"sha256": "b89060e0b12ca94580e60aefe1e1f10db3add65bbfd175c9c1a2797a72c669e9"
},
"downloads": -1,
"filename": "mds_irrulecontext-7.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b6ac084a32ad93c19ce41563a0079da0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 20006,
"upload_time": "2024-07-18T07:47:26",
"upload_time_iso_8601": "2024-07-18T07:47:26.956993Z",
"url": "https://files.pythonhosted.org/packages/dd/6c/c0e1a9c42a0d667a55f715e2bfd19a50967261507b6c3a23763fbd345ba0/mds_irrulecontext-7.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3340b4c0d7ffabb53db7fcff41ee2b0dbfc624802e8fbdce3b41d0d7a8a44ff2",
"md5": "ff1f1a21979698c6c72fdc6b2f580f60",
"sha256": "0581796e6b2e49f76eb6db917bc50983892749ec913e41b7dd310fba814c9a0e"
},
"downloads": -1,
"filename": "mds_irrulecontext-7.0.1.tar.gz",
"has_sig": false,
"md5_digest": "ff1f1a21979698c6c72fdc6b2f580f60",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 17922,
"upload_time": "2024-07-18T07:47:28",
"upload_time_iso_8601": "2024-07-18T07:47:28.688328Z",
"url": "https://files.pythonhosted.org/packages/33/40/b4c0d7ffabb53db7fcff41ee2b0dbfc624802e8fbdce3b41d0d7a8a44ff2/mds_irrulecontext-7.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-18 07:47:28",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "mds-irrulecontext"
}