[MERGE] from trunk

bzr revid: fva@openerp.com-20121008093552-nnf1ax5ueiotjtej
This commit is contained in:
Frédéric van der Essen
2012-10-08 11:35:52 +02:00
16 changed files with 50 additions and 80 deletions
+11 -9
View File
@@ -25,6 +25,7 @@
display: none !important;
}
}
.openerp.openerp_webclient_container {
height: 100%;
position: relative;
@@ -45,7 +46,7 @@
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
/* http://www.quirksmode.org/dom/inputfile.html
* http://stackoverflow.com/questions/2855589/replace-input-type-file-by-an-image
*/
*/ */
}
.openerp :-moz-placeholder {
color: #afafb6 !important;
@@ -515,6 +516,12 @@
.openerp .oe_webclient .oe_star_on {
color: gold;
}
.openerp p.oe_grey {
max-width: 650px;
}
.openerp .oe_grey {
color: #aaaaaa;
}
.openerp header {
position: relative;
border-bottom: 1px solid #cacaca;
@@ -1197,7 +1204,7 @@
color: white;
padding: 2px 4px;
margin: 1px 6px 0 0;
border: 1px solid lightgrey;
border: 1px solid lightGray;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
@@ -1222,7 +1229,7 @@
transform: scale(1.1);
}
.openerp .oe_secondary_submenu .oe_active {
border-top: 1px solid lightgrey;
border-top: 1px solid lightGray;
border-bottom: 1px solid #dedede;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
-moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), inset 0 -1px 3px rgba(40, 40, 40, 0.2);
@@ -2048,11 +2055,6 @@
margin: 0 auto;
padding: 16px 0 48px;
}
.openerp .oe_form header .oe_tags .oe_grey {
color: #aaaaaa;
max-width: 650px;
margin: 0 0 10px 0;
}
.openerp .oe_form header .oe_tags div.oe_form_configuration p, .openerp .oe_form header .oe_tags div.oe_form_configuration ul, .openerp .oe_form header .oe_tags div.oe_form_configuration ol {
color: #aaaaaa;
max-width: 650px;
@@ -2123,7 +2125,7 @@
}
.openerp .oe_form .oe_form_label_help[for] span, .openerp .oe_form .oe_form_label[for] span {
font-size: 80%;
color: darkgreen;
color: darkGreen;
vertical-align: top;
position: relative;
top: -4px;
+7 -6
View File
@@ -450,6 +450,11 @@ $sheet-max-width: 860px
text-decoration: none
.oe_star_on
color: gold
p.oe_grey
max-width: 650px
.oe_grey
color: #aaa
// }}}
// Generic blocks {{{
@@ -825,7 +830,7 @@ $sheet-max-width: 860px
vertical-align: top
text-shadow: 0 1px 1px rgba(0,0,0,0.2)
@include transition(all 0.2s ease-out)
&:hover,
&:hover
background: rgba(0,0,0,0.2)
text-shadow: black 0px 0px 3px
color: white
@@ -885,7 +890,7 @@ $sheet-max-width: 860px
vertical-align: top
text-shadow: 0 1px 1px rgba(0,0,0,0.2)
@include transition(all 0.2s ease-out)
&:hover,
&:hover
background: rgba(0,0,0,0.2)
text-shadow: black 0px 0px 3px
color: white
@@ -1623,10 +1628,6 @@ $sheet-max-width: 860px
max-width: $sheet-max-width
margin: 0 auto
padding: 16px 0 48px
.oe_grey
color: #aaa
max-width: 650px
margin: 0 0 10px 0
div.oe_form_configuration
p, ul, ol
color: #aaa
+5 -5
View File
@@ -392,7 +392,7 @@ instance.web.DatabaseManager = instance.web.Widget.extend({
do_create: function(form) {
var self = this;
var fields = $(form).serializeArray();
self.rpc("/web/database/create", {'fields': fields}, function(result) {
self.rpc("/web/database/create", {'fields': fields}).then(function(result) {
var form_obj = self.to_object(fields);
var client_action = {
type: 'ir.actions.client',
@@ -418,7 +418,7 @@ instance.web.DatabaseManager = instance.web.Widget.extend({
if (!db || !confirm("Do you really want to delete the database: " + db + " ?")) {
return;
}
self.rpc("/web/database/drop", {'fields': fields}, function(result) {
self.rpc("/web/database/drop", {'fields': fields}).then(function(result) {
if (result.error) {
self.display_error(result);
return;
@@ -481,7 +481,7 @@ instance.web.DatabaseManager = instance.web.Widget.extend({
var self = this;
self.rpc("/web/database/change_password", {
'fields': $(form).serializeArray()
}, function(result) {
}).then(function(result) {
if (result.error) {
self.display_error(result);
return;
@@ -660,7 +660,7 @@ instance.web.ChangePassword = instance.web.Widget.extend({
submitHandler: function (form) {
self.rpc("/web/session/change_password",{
'fields': $(form).serializeArray()
}, function(result) {
}).then(function(result) {
if (result.error) {
self.display_error(result);
return;
@@ -1165,7 +1165,7 @@ instance.web.EmbeddedClient = instance.web.Client.extend({
var self = this;
return $.when(this._super()).pipe(function() {
return instance.session.session_authenticate(self.dbname, self.login, self.key, true).pipe(function() {
return self.rpc("/web/action/load", { action_id: self.action_id }, function(result) {
return self.rpc("/web/action/load", { action_id: self.action_id }).then(function(result) {
var action = result;
action.flags = _.extend({
//views_switcher : false,
+3 -15
View File
@@ -842,7 +842,7 @@ instance.web.Widget = instance.web.Class.extend(instance.web.WidgetMixin, {
rpc: function(url, data, success, error) {
var def = $.Deferred().then(success, error);
var self = this;
instance.session.rpc(url, data). then(function() {
instance.session.rpc(url, data).then(function() {
if (!self.isDestroyed())
def.resolve.apply(def, arguments);
}, function() {
@@ -1300,7 +1300,7 @@ instance.web.JsonRPC = instance.web.CallbackEnabled.extend({
* @param {Function} error_callback function to execute on RPC call failure
* @returns {jQuery.Deferred} jquery-provided ajax deferred
*/
rpc: function(url, params, success_callback, error_callback) {
rpc: function(url, params) {
var self = this;
// url can be an $.ajax option object
if (_.isString(url)) {
@@ -1317,8 +1317,6 @@ instance.web.JsonRPC = instance.web.CallbackEnabled.extend({
};
var deferred = $.Deferred();
this.trigger('request', url, payload);
var aborter = params.aborter;
delete params.aborter;
var request = this.rpc_function(url, payload).then(
function (response, textStatus, jqXHR) {
self.trigger('response', response);
@@ -1342,16 +1340,6 @@ instance.web.JsonRPC = instance.web.CallbackEnabled.extend({
};
deferred.reject(error, $.Event());
});
if (aborter) {
aborter.abort_last = function () {
if (!(request.isResolved() || request.isRejected())) {
deferred.fail(function (error, event) {
event.preventDefault();
});
request.abort();
}
};
}
// Allow deferred user to disable on_rpc_error in fail
deferred.fail(function() {
deferred.fail(function(error, event) {
@@ -1359,7 +1347,7 @@ instance.web.JsonRPC = instance.web.CallbackEnabled.extend({
self.on_rpc_error(error, event);
}
});
}).then(success_callback, error_callback).promise();
});
return deferred;
},
/**
+2 -2
View File
@@ -19,9 +19,9 @@ instance.web.Session = instance.web.JsonRPC.extend( /** @lends instance.web.Sess
this.name = instance._session_id;
this.qweb_mutex = new $.Mutex();
},
rpc: function(url, params, success_callback, error_callback) {
rpc: function(url, params) {
params.session_id = this.session_id;
return this._super(url, params, success_callback, error_callback);
return this._super(url, params);
},
/**
* Setup a sessionm
+2 -20
View File
@@ -586,26 +586,8 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({
* @param {Function} error_callback
* @returns {$.Deferred}
*/
call: function (method, args, callback, error_callback) {
return this._model.call(method, args).then(callback, error_callback);
},
/**
* Calls an arbitrary method, with more crazy
*
* @param {String} method
* @param {Array} [args]
* @param {Number} [domain_index] index of a domain to evaluate in the args array
* @param {Number} [context_index] index of a context to evaluate in the args array
* @returns {$.Deferred}
*/
call_and_eval: function (method, args, domain_index, context_index) {
return instance.session.rpc('/web/dataset/call', {
model: this.model,
method: method,
domain_id: domain_index == undefined ? null : domain_index,
context_id: context_index == undefined ? null : context_index,
args: args || []
});
call: function (method, args) {
return this._model.call(method, args);
},
/**
* Calls a button method, usually returning some sort of action
+4 -4
View File
@@ -51,7 +51,7 @@ instance.web.DataExport = instance.web.Dialog.extend({
self.rpc("/web/export/get_fields", {
model: self.dataset.model,
import_compat: Boolean(import_comp)
}, function (records) {
}).then(function (records) {
got_fields.resolve();
self.on_show_data(records);
});
@@ -59,7 +59,7 @@ instance.web.DataExport = instance.web.Dialog.extend({
return $.when(
got_fields,
this.rpc('/web/export/formats', {}, this.do_setup_export_formats),
this.rpc('/web/export/formats', {}).then(this.do_setup_export_formats),
this.show_exports_list());
},
do_setup_export_formats: function (formats) {
@@ -93,7 +93,7 @@ instance.web.DataExport = instance.web.Dialog.extend({
self.$el.find('#fields_list option').remove();
var export_id = self.$el.find('#saved_export_list option:selected').val();
if (export_id) {
self.rpc('/web/export/namelist', {'model': self.dataset.model, export_id: parseInt(export_id)}, self.do_load_export_field);
self.rpc('/web/export/namelist', {'model': self.dataset.model, export_id: parseInt(export_id)}).then(self.do_load_export_field);
}
});
self.$el.find('#delete_export_list').click(function() {
@@ -183,7 +183,7 @@ instance.web.DataExport = instance.web.Dialog.extend({
import_compat: Boolean(import_comp),
parent_field_type : record['field_type'],
exclude: exclude_fields
}, function(results) {
}).then(function(results) {
record.loaded = true;
self.on_show_data(results, record.id);
});
+1 -1
View File
@@ -1693,7 +1693,7 @@ instance.web.search.Advanced = instance.web.search.Input.extend({
});
return $.when(
this._super(),
this.rpc("/web/searchview/fields_get", {model: this.view.model}, function(data) {
this.rpc("/web/searchview/fields_get", {model: this.view.model}).then(function(data) {
self.fields = _.extend({
id: { string: 'ID', type: 'id' }
}, data.fields);
+2 -2
View File
@@ -4489,7 +4489,7 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend
self.rpc('/web/session/eval_domain_and_context', {
domains: [],
contexts: [this.context]
}, function (results) {
}).then(function (results) {
var search_defaults = {};
_.each(results.context, function (value_, key) {
var match = /^search_default_(.*)$/.exec(key);
@@ -4557,7 +4557,7 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend
domains: domains || [],
contexts: contexts || [],
group_by_seq: groupbys || []
}, function (results) {
}).then(function (results) {
self.view_list.do_search(results.domain, results.context, results.group_by);
});
},
+1 -1
View File
@@ -482,7 +482,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
view_type: "tree",
context: this.dataset.get_context(context),
toolbar: !!this.options.$sidebar
}, callback);
}).then(callback);
}
},
/**
+1 -1
View File
@@ -45,7 +45,7 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie
view_type: "tree",
toolbar: this.view_manager ? !!this.view_manager.sidebar : false,
context: this.dataset.get_context()
}, this.on_loaded);
}).then(this.on_loaded);
},
/**
* Returns the list of fields needed to correctly read objects.
+5 -7
View File
@@ -654,7 +654,7 @@ instance.web.ViewManager = instance.web.Widget.extend({
domains: [this.action.domain || []].concat(domains || []),
contexts: [action_context].concat(contexts || []),
group_by_seq: groupbys || []
}, function (results) {
}).then(function (results) {
self.dataset._model = new instance.web.Model(
self.dataset.model, results.context, results.domain);
var groupby = results.group_by.length
@@ -813,13 +813,11 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({
});
break;
case 'fields':
this.dataset.call_and_eval(
'fields_get', [false, {}], null, 1).then(function (fields) {
this.dataset.call('fields_get', [false, {}]).then(function (fields) {
var $root = $('<dl>');
_(fields).each(function (attributes, name) {
$root.append($('<dt>').append($('<h4>').text(name)));
var $attrs = $('<dl>').appendTo(
$('<dd>').appendTo($root));
var $attrs = $('<dl>').appendTo($('<dd>').appendTo($root));
_(attributes).each(function (def, name) {
if (def instanceof Object) {
def = JSON.stringify(def);
@@ -1060,7 +1058,7 @@ instance.web.Sidebar = instance.web.Widget.extend({
self.rpc("/web/action/load", {
action_id: item.action.id,
context: additional_context
}, function(result) {
}).then(function(result) {
result.result.context = _.extend(result.result.context || {},
additional_context);
result.result.flags = result.result.flags || {};
@@ -1239,7 +1237,7 @@ instance.web.View = instance.web.Widget.extend({
args.push(context);
return dataset.call_button(action_data.name, args).then(handler);
} else if (action_data.type=="action") {
return this.rpc('/web/action/load', { action_id: action_data.name, context: context, do_not_eval: true}, handler);
return this.rpc('/web/action/load', { action_id: action_data.name, context: context, do_not_eval: true}).then(handler);
} else {
return dataset.exec_workflow(record_id, action_data.name).then(handler);
}
+2 -2
View File
@@ -82,14 +82,14 @@ $(document).ready(function () {
});
t.test('call', function (openerp) {
var ds = new openerp.web.DataSet({session: openerp.session}, 'mod');
t.expect(ds.call('frob', ['a', 'b', 42]), function (r) {
t.expect(ds.call('frob', ['a', 'b', 42]).then(function (r) {
strictEqual(r.method, 'frob');
strictEqual(r.args.length, 3);
deepEqual(r.args, ['a', 'b', 42]);
ok(_.isEmpty(r.kwargs));
});
}));
});
t.test('name_get').then(function (openerp) {
var ds = new openerp.web.DataSet({session: openerp.session}, 'mod');
@@ -41,7 +41,7 @@ instance.web_calendar.CalendarView = instance.web.View.extend({
},
start: function() {
this._super();
return this.rpc("/web/view/load", {"model": this.model, "view_id": this.view_id, "view_type":"calendar", 'toolbar': false}, this.on_loaded);
return this.rpc("/web/view/load", {"model": this.model, "view_id": this.view_id, "view_type":"calendar", 'toolbar': false}).then(this.on_loaded);
},
destroy: function() {
scheduler.clearAll();
+1 -2
View File
@@ -105,8 +105,7 @@ instance.web.DiagramView = instance.web.View.extend({
});
this.rpc(
'/web_diagram/diagram/get_diagram_info',params,
function(result) {
'/web_diagram/diagram/get_diagram_info',params).then(function(result) {
self.draw_diagram(result);
}
);
@@ -136,7 +136,7 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({
var field_dataset = new instance.web.DataSetSearch(this, this.model, null, null);
var model_dataset = new instance.web.DataSetSearch(this, 'ir.model', null, null);
var view_string = "", field_name = false, self = this;
field_dataset.call( 'fields_get', [], function(fields) {
field_dataset.call( 'fields_get', []).then(function(fields) {
_.each(['name', 'x_name'], function(value) {
if (_.include(_.keys(fields), value)) {
field_name = value;
@@ -539,7 +539,7 @@ instance.web_view_editor.ViewEditor = instance.web.Widget.extend({
var value = _.has(_CHILDREN, element) ? element : _.str.include(html_tag, element)?"html_tag":false;
property_to_check.push(value);
});
field_dataset.call( 'fields_get', [], function(result) {
field_dataset.call( 'fields_get', []).then(function(result) {
var fields = _.keys(result);
fields.push(" "),fields.sort();
self.on_add_node(property_to_check, fields);