},
});
-openerp.currentScript = function() {
- var currentScript = document.currentScript;
- if (!currentScript) {
- var sc = document.getElementsByTagName('script');
- currentScript = sc[sc.length-1];
- }
- return currentScript;
-};
-
openerp.web.EmbeddedClient = openerp.web.Widget.extend({
template: 'EmptyComponent',
init: function(action_id, options) {
start: function() {
var self = this;
-
this.am.appendTo(this.$element.addClass('openerp'));
-
return this.rpc("/web/action/load", { action_id: this.action_id }, function(result) {
var action = result.result;
action.flags = _.extend({
});
+openerp.web.embed = function (origin, dbname, login, key, action, options) {
+ var currentScript = document.currentScript;
+ if (!currentScript) {
+ var sc = document.getElementsByTagName('script');
+ currentScript = sc[sc.length-1];
+ }
+ openerp.connection.bind(origin).then(function () {
+ openerp.connection.session_authenticate(dbname, login, key).then(function () {
+ var client = new session.web.EmbeddedClient(action_id, options);
+ client.insertAfter(currentScript);
+ });
+ });
+}
};