{ "info": { "author": "", "author_email": "", "bugtrack_url": null, "classifiers": [ "Framework :: Odoo", "License :: OSI Approved :: GNU Affero General Public License v3", "Programming Language :: Python :: 2.7" ], "description": "Web Context Tunnel.\n===================\n\nThe problem with OpenERP on_changes\n-----------------------------------\n\nOpenERP uses to pass on_change Ajax events arguments using positional\narguments. This is annoying as modules often need to pass extra arguments\nthat are not present in the base on_change signatures. As soon as two modules\ntry to alter this signature to add their extra arguments, they are incompatible\nbetween them unless some extra glue module make them compatible again by\ntaking all extra arguments into account. But this leads to a combinatorial\nexplosion to make modules compatible again.\n\nThe solution\n------------\n\nThis module provides a simple work around that will work in most of the cases.\nIn fact it works if the base on_change is designed to pass the context\nargument. Else it won't work and you should go the old way. But in any case\nit's a bad practice if an on_change doesn't pass the context argument and you\ncan certainly rant about these bad on_changes to the the context added in the\narguments.\n\nSo for an on_change passing the context, how does this module works?\n\nWell OpenERP already has an elegant solution for an extension module to alter\nan XML attributes: put an extension point in the view using\nposition=\"attributes\" and then redefine the attribute. That is already used at\nseveral places to replace the \"context\" attribute that the client will send to\nthe server.\n\nThe idea here is to wrap the extra arguments needed by your on_change inside\nthat context dictionary just as it were a regular Python kwargs. That context\nshould then be automatically propagated accross the on_change call chain,\nno matter of the module order and without any need to hack any on_change\nsignature.\n\nThe issue with just position=\"attributes\" and redefining the context, is that\nagain, if two independent modules redefine the context, they are incompatible\nunless a third module accounts for both of them.\n\nBut with this module, an extension point can now use position=\"attributes\" and\ninstead of redefining the \"context\" attribute, you will now just define a new\n\"context_foo\" attribute this way:\n{'my_extra_field': my_extra_field}.\n\nThis module modifies the web client in such a way that before sending the Ajax\non_change event request to the server, all the node attributes starting with\n\"context\" are merged into a single context dictionnary, keeping the keys and\nvalues from all extensions. In the rare case a module really wants to override\nthe value in context, then it needs to still override the original context\nattribute (or the other original attribute).\n\nAnd of course, if you should call your on_change by API or webservice instead\nof using the web client, simply ensure you are wrapping the required extra\narguments in the context dictionary.\n\nTests\n-----\n\nThis module comes with a simple test in static/test/context_tunnel.js.\nTo run it, open the page /web/tests?mod=web_context_tunnel in your browser\nas explained here https://doc.openerp.com/trunk/web/testing\nIt should also be picked by the Python testing when testing with PhantomJS.\n\nAs for testing modules using web_context_tunnel with YAML, yes it's possible.\nIn fact you need to manually mimic the new web-client behavior by manually\nensuring you add the extra context keys you will need later in your on_change.\nFor instance, before the on_change is called, you can alter the context with\na !python statement like context.update({'my_extra_field': my_extra_field}).\n\nYou can see an example of module conversion to use web_context_tunnel here\nfor instance:\nhttps://github.com/openerpbrasil/l10n_br_core/commit/33065366726a83dbc69b9f0031c81d82362fbfae", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "AGPL-3", "maintainer": "", "maintainer_email": "", "name": "odoo8-addon-web-context-tunnel", "package_url": "https://pypi.org/project/odoo8-addon-web-context-tunnel/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/odoo8-addon-web-context-tunnel/", "project_urls": null, "release_url": "https://pypi.org/project/odoo8-addon-web-context-tunnel/8.0.2.0.0/", "requires_dist": [ "odoo (<9.0a,>=8.0a)" ], "requires_python": "", "summary": "Web Context Tunnel", "version": "8.0.2.0.0" }, "last_serial": 3998639, "releases": { "8.0.2.0.0": [ { "comment_text": "", "digests": { "md5": "046df1f1983ceddc91e0179c99fc3548", "sha256": "4513396097cfc17c5c17973f8abf6220fc2f4030687a1fe39b85baa6d24f0008" }, "downloads": -1, "filename": "odoo8_addon_web_context_tunnel-8.0.2.0.0-py2-none-any.whl", "has_sig": false, "md5_digest": "046df1f1983ceddc91e0179c99fc3548", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 20034, "upload_time": "2017-04-11T16:49:55", "url": "https://files.pythonhosted.org/packages/65/ae/fd64cc7515f5902ba4101ee7eba9f179812c2d4911ca10c44c878f546257/odoo8_addon_web_context_tunnel-8.0.2.0.0-py2-none-any.whl" } ], "8.0.2.0.0.99.dev1": [ { "comment_text": "", "digests": { "md5": "bbfcb51dd323d1fefb2195801e006333", "sha256": "3727abd45aed5edafd976a41ec0a4b1372c6800e14c0ad6346c9c0457d657905" }, "downloads": -1, "filename": "odoo8_addon_web_context_tunnel-8.0.2.0.0.99.dev1-py2-none-any.whl", "has_sig": false, "md5_digest": "bbfcb51dd323d1fefb2195801e006333", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": "~=2.7", "size": 19825, "upload_time": "2018-06-16T04:54:15", "url": "https://files.pythonhosted.org/packages/50/0a/6e62b8d92f95cf6c7804e734b98fa5635095f7c5e45be598b2bb820e8579/odoo8_addon_web_context_tunnel-8.0.2.0.0.99.dev1-py2-none-any.whl" } ], "8.0.2.0.0.99.dev2": [ { "comment_text": "", "digests": { "md5": "7305314656ad297f408145217fa73e2a", "sha256": "ad0dcfd748302aa10dfa291a763ca05b14871323f403077af1661d841f6835e1" }, "downloads": -1, "filename": "odoo8_addon_web_context_tunnel-8.0.2.0.0.99.dev2-py2-none-any.whl", "has_sig": false, "md5_digest": "7305314656ad297f408145217fa73e2a", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": "~=2.7", "size": 20292, "upload_time": "2018-06-25T04:45:11", "url": "https://files.pythonhosted.org/packages/bb/f4/42c6b388201284721772b71f089c861c9cd8ba77dacb97ad8ecdc543abd0/odoo8_addon_web_context_tunnel-8.0.2.0.0.99.dev2-py2-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "046df1f1983ceddc91e0179c99fc3548", "sha256": "4513396097cfc17c5c17973f8abf6220fc2f4030687a1fe39b85baa6d24f0008" }, "downloads": -1, "filename": "odoo8_addon_web_context_tunnel-8.0.2.0.0-py2-none-any.whl", "has_sig": false, "md5_digest": "046df1f1983ceddc91e0179c99fc3548", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 20034, "upload_time": "2017-04-11T16:49:55", "url": "https://files.pythonhosted.org/packages/65/ae/fd64cc7515f5902ba4101ee7eba9f179812c2d4911ca10c44c878f546257/odoo8_addon_web_context_tunnel-8.0.2.0.0-py2-none-any.whl" } ] }