summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorAntony Lesuisse <al@openerp.com>2012-06-12 18:46:32 +0200
committerAntony Lesuisse <al@openerp.com>2012-06-12 18:46:32 +0200
commit10f3d175ebbc35a568fd4bfe934bc3deeb751e61 (patch)
tree367fc13311ab8db04c1fa61bc715074794065f5f /addons/web/static/src/js
parentf95c6ab4a84c6391e6667d8c7a12e24960b4fb21 (diff)
parentbc6de08dad3ff6fdb3f91c450503a5e269e088ee (diff)
[MERGE] trunk
bzr revid: al@openerp.com-20120612164632-rwahvy84nkjrsu7t
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/boot.js5
-rw-r--r--addons/web/static/src/js/chrome.js4
-rw-r--r--addons/web/static/src/js/view_form.js41
-rw-r--r--addons/web/static/src/js/view_list.js1
4 files changed, 31 insertions, 20 deletions
diff --git a/addons/web/static/src/js/boot.js b/addons/web/static/src/js/boot.js
index f83dbc97095..86f8077b151 100644
--- a/addons/web/static/src/js/boot.js
+++ b/addons/web/static/src/js/boot.js
@@ -54,11 +54,6 @@ openerp.web = function(session) {
openerp.web[files[i]](session);
}
}
- session.log = function() {
- if (session.connection.debug && window.console) {
- console.log.apply(console, arguments);
- }
- }
};
// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js
index a36421f2b2b..833111c79db 100644
--- a/addons/web/static/src/js/chrome.js
+++ b/addons/web/static/src/js/chrome.js
@@ -9,8 +9,7 @@ instance.web.Notification = instance.web.Widget.extend({
template: 'Notification',
init: function() {
this._super.apply(this, arguments);
- // move to instance.web.notification
- instance.notification = this;
+ instance.web.notification = this;
},
start: function() {
this._super.apply(this, arguments);
@@ -141,7 +140,6 @@ instance.web.Dialog = instance.web.Widget.extend({
}
},
on_resized: function() {
- //openerp.log("Dialog resized to %d x %d", this.$element.width(), this.$element.height());
},
destroy: function () {
this.close();
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index 64381a66218..7a51cbce3c5 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -728,7 +728,6 @@ instance.web.FormView = instance.web.View.extend(_.extend({}, instance.web.form.
if (this.sidebar) {
this.sidebar.do_attachement_update(this.dataset, this.datarecord.id);
}
- //instance.log("The record has been created with id #" + this.datarecord.id);
this.reload();
return $.when(_.extend(r, {created: true})).then(success);
}
@@ -914,6 +913,10 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt
},
set_fields_view: function(fvg) {
this.fvg = fvg;
+ this.version = parseFloat(this.fvg.arch.attrs.version);
+ if (isNaN(this.version)) {
+ this.version = 6.1;
+ }
},
set_tags_registry: function(tags_registry) {
this.tags_registry = tags_registry;
@@ -921,6 +924,18 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt
set_fields_registry: function(fields_registry) {
this.fields_registry = fields_registry;
},
+ // Backward compatibility tools, current default version: v6.1
+ process_version: function() {
+ if (this.version < 7.0) {
+ this.$form.find('form:first').wrapInner('<group col="4"/>');
+ this.$form.find('page').each(function() {
+ if (!$(this).parents('field').length) {
+ $(this).wrapInner('<group col="4"/>');
+ }
+ });
+ }
+ selector = 'form[version!="7.0"] page,form[version!="7.0"]';
+ },
render_to: function($target) {
var self = this;
this.$target = $target;
@@ -930,6 +945,8 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt
var xml = instance.web.json_node_to_xml(this.fvg.arch);
this.$form = $('<div class="oe_form">' + xml + '</div>');
+ this.process_version();
+
this.fields_to_init = [];
this.tags_to_init = [];
this.labels = {};
@@ -2724,6 +2741,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({
},
start: function() {
this._super.apply(this, arguments);
+ this.$element.addClass('oe_form_field_one2many');
var self = this;
@@ -2731,7 +2749,6 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({
this.dataset.o2m = this;
this.dataset.parent_view = this.view;
this.dataset.child_name = this.name;
- //this.dataset.child_name =
this.dataset.on_change.add_last(function() {
self.trigger_on_change();
});
@@ -2763,6 +2780,11 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({
modes = !!modes ? modes.split(",") : ["tree"];
var views = [];
_.each(modes, function(mode) {
+ if (! _.include(["list", "tree", "graph", "kanban"], mode)) {
+ instance.webclient.notification.warn(
+ _.str.sprintf("View type '%s' is not supported in One2Many.", mode));
+ return;
+ }
var view = {
view_id: false,
view_type: mode == "tree" ? "list" : mode,
@@ -2784,6 +2806,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({
view.options.not_interactible_on_create = true;
} else if (view.view_type === "kanban") {
view.options.confirm_on_delete = false;
+ view.options.sortable = false;
if (self.get("effective_readonly")) {
view.options.action_buttons = false;
view.options.quick_creatable = false;
@@ -3260,6 +3283,7 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({
},
start: function() {
this._super.apply(this, arguments);
+ this.$element.addClass('oe_form_field_many2many');
var self = this;
@@ -3268,7 +3292,7 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({
this.dataset.on_unlink.add_last(function(ids) {
self.dataset_changed();
});
-
+
this.is_setted.then(function() {
self.load_view();
});
@@ -3281,7 +3305,7 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({
});
});
});
- })
+ });
},
set_value: function(value_) {
value_ = value_ || [];
@@ -3303,6 +3327,7 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({
'addable': self.get("effective_readonly") ? null : _t("Add"),
'deletable': self.get("effective_readonly") ? false : true,
'selectable': self.multi_selection,
+ 'sortable': false,
});
var embedded = (this.field.views || {}).tree;
if (embedded) {
@@ -4073,14 +4098,6 @@ instance.web.form.FieldBinaryFile = instance.web.form.FieldBinary.extend({
instance.web.form.FieldBinaryImage = instance.web.form.FieldBinary.extend({
template: 'FieldBinaryImage',
- initialize_content: function() {
- this._super();
- if (!this.get("effective_readonly")) {
- this.$element.find('.oe_form_field_image_controls').show();
- } else {
- this.$element.find('.oe_form_field_image_controls').hide();
- }
- },
set_value: function(value_) {
this._super.apply(this, arguments);
this.render_value();
diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js
index de73ec21884..a90dabe1b4c 100644
--- a/addons/web/static/src/js/view_list.js
+++ b/addons/web/static/src/js/view_list.js
@@ -364,6 +364,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
}
var total = dataset.size();
+ this.$pager.toggleClass('oe_list_pager_single_page', (total <= this.limit()));
var spager = '-';
if (total) {
var range_start = this.page * this.limit() + 1;