From 58b58af75b30736b7b8f7cd6c11874714f4dae8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Fri, 19 Sep 2014 08:20:46 -0300 Subject: [PATCH 1/2] web_context_tunnel v8 port: asset bundle + tests --- .../__init__.py | 0 .../__openerp__.py | 7 ++++--- .../i18n/web_context_tunnel.pot | 0 .../static/src/js/context_tunnel.js | 3 --- .../static/test/context_tunnel.js | 4 +++- web_context_tunnel/views/web_context_tunnel.xml | 16 ++++++++++++++++ 6 files changed, 23 insertions(+), 7 deletions(-) rename {__unported__/web_context_tunnel => web_context_tunnel}/__init__.py (100%) rename {__unported__/web_context_tunnel => web_context_tunnel}/__openerp__.py (96%) rename {__unported__/web_context_tunnel => web_context_tunnel}/i18n/web_context_tunnel.pot (100%) rename {__unported__/web_context_tunnel => web_context_tunnel}/static/src/js/context_tunnel.js (97%) rename {__unported__/web_context_tunnel => web_context_tunnel}/static/test/context_tunnel.js (87%) create mode 100644 web_context_tunnel/views/web_context_tunnel.xml diff --git a/__unported__/web_context_tunnel/__init__.py b/web_context_tunnel/__init__.py similarity index 100% rename from __unported__/web_context_tunnel/__init__.py rename to web_context_tunnel/__init__.py diff --git a/__unported__/web_context_tunnel/__openerp__.py b/web_context_tunnel/__openerp__.py similarity index 96% rename from __unported__/web_context_tunnel/__openerp__.py rename to web_context_tunnel/__openerp__.py index ba2616bea..ff5741f20 100644 --- a/__unported__/web_context_tunnel/__openerp__.py +++ b/web_context_tunnel/__openerp__.py @@ -68,7 +68,7 @@ Tests This module comes with a simple test in static/test/context_tunnel.js. To run it, open the page /web/tests?mod=web_context_tunnel in your browser as explained here https://doc.openerp.com/trunk/web/testing -It should also by picked by the Python testing when testing with PhantomJS. +It should also be picked by the Python testing when testing with PhantomJS. As for testing modules using web_context_tunnel with YAML, yes it's possible. In fact you need to manually mimic the new web-client behavior by manually @@ -82,12 +82,13 @@ https://github.com/openerpbrasil/l10n_br_core/compare/develop...feature%2Fsale-w """, 'version': '2.0', 'depends': ['web'], - 'js': ['static/src/js/context_tunnel.js'], + 'data': [ + 'views/web_context_tunnel.xml', + ], 'test': [ 'static/test/context_tunnel.js', ], 'css': [], 'auto_install': False, - 'installable': False, 'web_preload': False, } diff --git a/__unported__/web_context_tunnel/i18n/web_context_tunnel.pot b/web_context_tunnel/i18n/web_context_tunnel.pot similarity index 100% rename from __unported__/web_context_tunnel/i18n/web_context_tunnel.pot rename to web_context_tunnel/i18n/web_context_tunnel.pot diff --git a/__unported__/web_context_tunnel/static/src/js/context_tunnel.js b/web_context_tunnel/static/src/js/context_tunnel.js similarity index 97% rename from __unported__/web_context_tunnel/static/src/js/context_tunnel.js rename to web_context_tunnel/static/src/js/context_tunnel.js index aab1d5acd..699b84e36 100644 --- a/__unported__/web_context_tunnel/static/src/js/context_tunnel.js +++ b/web_context_tunnel/static/src/js/context_tunnel.js @@ -22,6 +22,3 @@ openerp.web_context_tunnel = function(instance) { return v_context; }; }; - - -// vim:et fdc=0 fdl=0: diff --git a/__unported__/web_context_tunnel/static/test/context_tunnel.js b/web_context_tunnel/static/test/context_tunnel.js similarity index 87% rename from __unported__/web_context_tunnel/static/test/context_tunnel.js rename to web_context_tunnel/static/test/context_tunnel.js index f0fab997c..7dbe16575 100644 --- a/__unported__/web_context_tunnel/static/test/context_tunnel.js +++ b/web_context_tunnel/static/test/context_tunnel.js @@ -1,7 +1,9 @@ openerp.testing.section('context_tunnel', { + dependencies: ['web.list', 'web.form'], + templates: true }, function (test) { - test.dependencies = window['oe_all_dependencies']; test("context composition", function (instance) { + new openerp.web_context_tunnel(instance); var field_manager = new instance.web.form.DefaultFieldManager(); var node = {'attrs': {'context': {'key1': 'value1', 'key2': 'value2'}, 'context_2': {'key3': 'value3'}, 'context_3': {'key4': 'value4'}}} var w = new instance.web.form.FormWidget(field_manager, node); diff --git a/web_context_tunnel/views/web_context_tunnel.xml b/web_context_tunnel/views/web_context_tunnel.xml new file mode 100644 index 000000000..983b664de --- /dev/null +++ b/web_context_tunnel/views/web_context_tunnel.xml @@ -0,0 +1,16 @@ + + + + + + + + From 955ff38cf315e92eb1b5c7c463dc642cd21460bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Sat, 20 Sep 2014 18:19:43 -0300 Subject: [PATCH 2/2] updated example --- web_context_tunnel/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_context_tunnel/__openerp__.py b/web_context_tunnel/__openerp__.py index ff5741f20..710dc8862 100644 --- a/web_context_tunnel/__openerp__.py +++ b/web_context_tunnel/__openerp__.py @@ -78,7 +78,7 @@ a !python statement like context.update({'my_extra_field': my_extra_field}). You can see an example of module conversion to use web_context_tunnel here for instance: -https://github.com/openerpbrasil/l10n_br_core/compare/develop...feature%2Fsale-web-context-tunnel +https://github.com/openerpbrasil/l10n_br_core/commit/33065366726a83dbc69b9f0031c81d82362fbfae """, 'version': '2.0', 'depends': ['web'],