From 78c82fc0c656ab579593a600b52c3362b0dded7d Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 29 Aug 2013 14:44:48 +0200 Subject: [FIX] tree views: rename variable parent-id to avoid conflicts with record fields name (eg: account.account) bzr revid: mat@openerp.com-20130829124448-xr89v0gsuoukqhao --- addons/web/static/src/js/view_tree.js | 11 +++++------ addons/web/static/src/xml/base.xml | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_tree.js b/addons/web/static/src/js/view_tree.js index a9ec2bb6001..70873f48d6f 100644 --- a/addons/web/static/src/js/view_tree.js +++ b/addons/web/static/src/js/view_tree.js @@ -163,13 +163,13 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie var is_loaded = 0, $this = $(this), record_id = $this.data('id'), - parent_id = $this.data('parent-id'), + row_parent_id = $this.data('row-parent-id'), record = self.records[record_id], children_ids = record[self.children_field]; _(children_ids).each(function(childid) { - if (self.$el.find('[id=treerow_' + childid + '][data-parent-id='+ record_id +']').length ) { - if (self.$el.find('[id=treerow_' + childid + '][data-parent-id='+ record_id +']').is(':hidden')) { + if (self.$el.find('[id=treerow_' + childid + '][data-row-parent-id='+ record_id +']').length ) { + if (self.$el.find('[id=treerow_' + childid + '][data-row-parent-id='+ record_id +']').is(':hidden')) { is_loaded = -1; } else { is_loaded++; @@ -193,7 +193,6 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie _(records).each(function (record) { self.records[record.id] = record; }); - var $curr_node = self.$el.find('#treerow_' + id); var children_rows = QWeb.render('TreeView.rows', { 'records': records, @@ -203,7 +202,7 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie 'level': $curr_node.data('level') || 0, 'render': instance.web.format_value, 'color_for': self.color_for, - 'parent_id': id + 'row_parent_id': id }); if ($curr_node.length) { $curr_node.addClass('oe_open'); @@ -247,7 +246,7 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie showcontent: function (curnode,record_id, show) { curnode.parent('tr').toggleClass('oe_open', show); _(this.records[record_id][this.children_field]).each(function (child_id) { - var $child_row = this.$el.find('[id=treerow_' + child_id + '][data-parent-id='+ curnode.data('id') +']'); + var $child_row = this.$el.find('[id=treerow_' + child_id + '][data-row-parent-id='+ curnode.data('id') +']'); if ($child_row.hasClass('oe_open')) { $child_row.toggleClass('oe_open',show); this.showcontent($child_row, child_id, false); diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 470c6e83d07..c5bc624c2b1 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -685,7 +685,7 @@ t-foreach="records" t-as="record" t-att-id="'treerow_' + record.id" t-att-data-id="record.id" t-att-data-level="level + 1" - t-att-data-parent-id="parent_id"> + t-att-data-row-parent-id="row_parent_id"> -- cgit v1.2.3 From 1bd6608df9bc2f400d219d232ae715e8c114379d Mon Sep 17 00:00:00 2001 From: Anael Closson Date: Thu, 5 Sep 2013 11:21:22 +0200 Subject: [FIX] OWP 593963 : limit results when opening "search more" as it's really slow when lot of records in database bzr revid: acl@openerp.com-20130905092122-47ynnssvvvo4aef2 --- addons/web/static/src/js/view_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index b9f1d91b700..c7314888703 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2934,7 +2934,7 @@ instance.web.form.CompletionFieldMixin = { values.push({ label: _t("Search More..."), action: function() { - dataset.name_search(search_val, self.build_domain(), 'ilike', false).done(function(data) { + dataset.name_search(search_val, self.build_domain(), 'ilike', 160).done(function(data) { self._search_create_popup("search", data); }); }, -- cgit v1.2.3 From dbedded58e3db57e3532dbc7cc0881e3c9fd0fa0 Mon Sep 17 00:00:00 2001 From: Anael Closson Date: Thu, 5 Sep 2013 17:58:17 +0200 Subject: [FIX] OPW 597162 : context not properly retreived and therefore not sent when retreiving o2m and m2m lines lp bug: https://launchpad.net/bugs/1217374 fixed bzr revid: acl@openerp.com-20130905155817-llmjnsmd252q3286 --- addons/web/static/src/js/data.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 679afe77bcd..e535be294aa 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -432,7 +432,7 @@ instance.web.DataSet = instance.web.Class.extend(instance.web.PropertiesMixin, // TODO: reorder results to match ids list return this._model.call('read', [ids, fields || false], - {context: this._model.context(options.context)}); + {context: this.get_context(options.context)}); }, /** * Read a slice of the records represented by this DataSet, based on its -- cgit v1.2.3 From 56382a450a4c5572a17dca3054bf23654013910a Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Fri, 13 Sep 2013 12:40:26 +0200 Subject: [FIX] problem with page reload after installing a module lp bug: https://launchpad.net/bugs/1214814 fixed bzr revid: nicolas.vanhoren@openerp.com-20130913104026-rxtl7h1u7vuixyvm --- addons/web/static/src/js/chrome.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 55ab5ec073d..793dbd43d76 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -808,7 +808,7 @@ instance.web.redirect = function(url, wait) { if (old === url) { window.location.reload(); } else { - window.location = url; + window.location.href = url; } }; -- cgit v1.2.3 From 6d411f706509316795ecb3eb362f0b42b2740ae6 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Fri, 13 Sep 2013 14:40:26 +0200 Subject: [FIX] really solve reload problem lp bug: https://launchpad.net/bugs/1214814 fixed bzr revid: nicolas.vanhoren@openerp.com-20130913124026-yhchgik5yznkme19 --- addons/web/static/src/js/chrome.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 793dbd43d76..11a2e58ae5b 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -805,10 +805,11 @@ instance.web.redirect = function(url, wait) { var load = function() { var old = "" + window.location; - if (old === url) { - window.location.reload(); - } else { - window.location.href = url; + var old_no_hash = old.split("#")[0]; + var url_no_hash = url.split("#")[0]; + location.assign(url); + if (old_no_hash === url_no_hash) { + location.reload(true); } }; -- cgit v1.2.3 From 14a8b64f02d67d7b40e19c5291827892f4ca22dd Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 19 Sep 2013 15:55:17 +0200 Subject: [FIX]web base: when kanban view was setted after the tree view in the views sequence, the form view was located in the footer of the web page. bzr revid: dle@openerp.com-20130919135517-5e3pvtbyvz13vn31 --- addons/web/static/src/css/base.css | 2 +- addons/web/static/src/css/base.sass | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 977f72fc1e0..9e77fc316b5 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1432,7 +1432,7 @@ display: table-row; height: inherit; } -.openerp .oe_view_manager .oe_view_manager_view_kanban { +.openerp .oe_view_manager .oe_view_manager_view_kanban:not(:empty) { height: inherit; } .openerp .oe_view_manager table.oe_view_manager_header { diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 75b81487743..b2cca813331 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1150,7 +1150,7 @@ $sheet-padding: 16px .oe_view_manager_body display: table-row height: inherit - .oe_view_manager_view_kanban + .oe_view_manager_view_kanban:not(:empty) height: inherit table.oe_view_manager_header -- cgit v1.2.3 From 38e3daed00b9bfc7386a0c08debe7bc2f164f165 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Wed, 25 Sep 2013 16:45:56 +0200 Subject: wip bzr revid: nicolas.vanhoren@openerp.com-20130925144556-97abdprnibq631sc --- addons/web/static/src/js/view_form.js | 71 +++++++++++++++++++++++++++++++++++ addons/web/static/src/xml/base.xml | 13 +++++++ 2 files changed, 84 insertions(+) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 324896112cc..679eee0d361 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -5629,6 +5629,76 @@ instance.web.form.FieldMonetary = instance.web.form.FieldFloat.extend({ }, }); +/* + +*/ +instance.web.form.FieldMany2ManyCheckBoxes = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, { + className: "oe_form_many2many_checkboxes", + init: function() { + this._super.apply(this, arguments); + this.set("value", {}); + this.set("records", []); + this.field_manager.on("view_content_has_changed", this, function() { + var domain = new openerp.web.CompoundDomain(this.build_domain()).eval(); + if (! _.isEqual(domain, this.get("domain"))) { + this.set("domain", domain); + } + }); + this.records_orderer = new instance.web.DropMisordered(); + }, + initialize_field: function() { + instance.web.form.ReinitializeFieldMixin.initialize_field.call(this) + this.on("change:domain", this, this.query_records); + this.set("domain", new openerp.web.CompoundDomain(this.build_domain()).eval()); + this.on("change:records", this, this.render_value); + }, + query_records: function() { + var self = this; + var model = new openerp.Model(openerp.session, this.field.relation); + this.records_orderer.add(model.call("search", [this.get("domain")], {"context": this.build_context()}).then(function(record_ids) { + return model.call("name_get", [record_ids] , {"context": self.build_context()}); + })).then(function(res) { + self.set("records", res); + }); + }, + render_value: function() { + this.$().html(QWeb.render("FieldMany2ManyCheckBoxes", {widget: this, selected: this.get("value")})); + var inputs = this.$("input"); + inputs.change(_.bind(this.from_dom, this)); + if (this.get("effective_readonly")) + inputs.attr("disabled", "true"); + }, + from_dom: function() { + var new_value = {}; + this.$("input").each(function() { + var elem = $(this); + new_value[elem.data("record-id")] = elem.attr("checked") ? true : undefined; + }); + if (! _.isEqual(new_value, this.get("value"))) + this.internal_set_value(new_value); + }, + set_value: function(value) { + value = value || []; + if (value.length >= 1 && value[0] instanceof Array) { + value = value[0][2]; + } + var formatted = {}; + _.each(value, function(el) { + formatted[JSON.stringify(el)] = true; + }); + this._super(formatted); + }, + get_value: function() { + var value = _.filter(_.keys(this.get("value")), function(el) { + return this.get("value")[el]; + }, this); + value = _.map(value, function(el) { + return JSON.parse(el); + }); + return [commands.replace_with(value)]; + }, +}); + /** * Registry of form fields, called by :js:`instance.web.FormView`. * @@ -5664,6 +5734,7 @@ instance.web.form.widgets = new instance.web.Registry({ 'many2many_binary': 'instance.web.form.FieldMany2ManyBinaryMultiFiles', 'statusbar': 'instance.web.form.FieldStatus', 'monetary': 'instance.web.form.FieldMonetary', + 'many2many_checkboxes': 'instance.web.form.FieldMany2ManyCheckBoxes', }); /** diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index ee87237d045..48c51c4837c 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1934,4 +1934,17 @@ + + +
+ + + + + + + +
+
+
-- cgit v1.2.3 From 4aad26f5c27391afe235218b868652755c399f73 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 26 Sep 2013 18:49:02 +0200 Subject: [ADD] es5-shim bzr revid: fme@openerp.com-20130926164902-5ioas0np4tb9qnge --- addons/web/static/src/js/core.js | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/core.js b/addons/web/static/src/js/core.js index 8c69f86c47e..37a217a8664 100644 --- a/addons/web/static/src/js/core.js +++ b/addons/web/static/src/js/core.js @@ -11,31 +11,6 @@ if (typeof(console) === "undefined") { }); } -// shim provided by mozilla for function.bind -if (!Function.prototype.bind) { - Function.prototype.bind = function (oThis) { - if (typeof this !== "function") { - // closest thing possible to the ECMAScript 5 internal IsCallable function - throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable"); - } - - var aArgs = Array.prototype.slice.call(arguments, 1), - fToBind = this, - fNOP = function () {}, - fBound = function () { - return fToBind.apply(this instanceof fNOP && oThis - ? this - : oThis, - aArgs.concat(Array.prototype.slice.call(arguments))); - }; - - fNOP.prototype = this.prototype; - fBound.prototype = new fNOP(); - - return fBound; - }; -} - var instance = openerp; openerp.web.core = {}; -- cgit v1.2.3 From fb17860c4110baa50d7d9bbde1afe176c5f7085e Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Tue, 1 Oct 2013 18:07:54 +0200 Subject: [IMP] doc bzr revid: nicolas.vanhoren@openerp.com-20131001160754-w47z24xf3wtkqioh --- addons/web/static/src/js/view_form.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 679eee0d361..a00b66cbeda 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -5630,7 +5630,9 @@ instance.web.form.FieldMonetary = instance.web.form.FieldFloat.extend({ }); /* - + This type of field display a list of checkboxes. It works only with m2ms. This field will display one checkbox for each + record existing in the model targeted by the relation, according to the given domain if one is specified. Checked records + will be added to the relation. */ instance.web.form.FieldMany2ManyCheckBoxes = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, { className: "oe_form_many2many_checkboxes", -- cgit v1.2.3 From 58281701e99a03b671f60f614a6f1ce0a8f5def7 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 2 Oct 2013 11:46:34 +0200 Subject: [FIX] web: remove firefox css fix for view switch icons bzr revid: chs@openerp.com-20131002094634-9g7b20vs7n5yw4kh --- addons/web/static/src/css/base.css | 3 --- addons/web/static/src/css/base.sass | 2 -- 2 files changed, 5 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 97bbb2b207c..fe14cc28a62 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -3211,9 +3211,6 @@ } @-moz-document url-prefix() { - .openerp .oe_view_manager .oe_view_manager_switch li { - line-height: 21px; - } .openerp .oe_searchview .oe_searchview_search { top: -1px; } diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index e41a182407d..5571b5696fc 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2532,8 +2532,6 @@ $sheet-padding: 16px // }}} @-moz-document url-prefix() .openerp - .oe_view_manager .oe_view_manager_switch li - line-height: 21px .oe_searchview .oe_searchview_search top: -1px .oe_form_field_many2one .oe_m2o_cm_button -- cgit v1.2.3 From 5a70bc038a2fa5aeb14ac3b3d95c4e619fa4e058 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Wed, 2 Oct 2013 16:37:40 +0200 Subject: Changed base url bzr revid: nicolas.vanhoren@openerp.com-20131002143740-jr8xz6j4qgs97ztp --- addons/web/static/src/js/chrome.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 11a2e58ae5b..09694bb0c38 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -534,7 +534,7 @@ instance.web.DatabaseManager = instance.web.Widget.extend({ 'login': 'admin', 'password': form_obj['create_admin_pwd'], 'login_successful': function() { - var url = '/?db=' + form_obj['db_name']; + var url = '/web?db=' + form_obj['db_name']; if (self.session.debug) { url += '&debug'; } -- cgit v1.2.3 From 6e6977e0f24fdf273f43b5d8a5a9a6aa4a22c007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 3 Oct 2013 11:00:49 +0200 Subject: [FIX] web: form_view: FieldStatus widget: fixed hidden states/stages not appearing because behind displayed sheet. bzr revid: tde@openerp.com-20131003090049-88q0o69970eahb2h --- addons/web/static/src/css/base.css | 1 + addons/web/static/src/css/base.sass | 1 + 2 files changed, 2 insertions(+) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index fe14cc28a62..51c3fd30f3c 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -2741,6 +2741,7 @@ } .openerp ul.oe_form_status .oe_folded ul, .openerp ul.oe_form_status_clickable .oe_folded ul { position: absolute; + z-index: 1000; border-top: 1px solid #cacaca; float: none; top: 30px; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 5571b5696fc..a0231387e7f 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2179,6 +2179,7 @@ $sheet-padding: 16px padding-bottom: 8px ul position: absolute + z-index: 1000 border-top: 1px solid #cacaca float: none top: 30px -- cgit v1.2.3 From 63c0220d3152332e54f118c6affc9fffcacde3dd Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Fri, 4 Oct 2013 17:37:34 +0200 Subject: still some problems bzr revid: nicolas.vanhoren@openerp.com-20131004153734-rxdt32qvu3gcxip2 --- addons/web/static/src/js/view_form.js | 75 +++++++++++++++++++++++++++++++++++ addons/web/static/src/xml/base.xml | 3 ++ 2 files changed, 78 insertions(+) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index a00b66cbeda..2069a33ab2a 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -5701,6 +5701,80 @@ instance.web.form.FieldMany2ManyCheckBoxes = instance.web.form.AbstractField.ext }, }); +instance.web.form.X2ManyCounter = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, { + className: "oe_form_x2many_counter", + init: function() { + this._super.apply(this, arguments); + this.set("value", []); + _.defaults(this.options, { + "views": [[false, "tree"], [false, "form"]], + }); + }, + render_value: function() { + var text = _.str.sprintf("%d %s", this.val().length, this.string); + this.$().html(QWeb.render("X2ManyCounter", {text: text})); + this.$("a").click(_.bind(this.go_to, this)); + }, + go_to: function() { + return this.view.recursive_save().then(_.bind(function() { + var val = this.val(); + var context = {}; + +/* +Object {groups_id: Array[0], domain: false, help: "

Click here to …documents, etc.↵

↵ ", res_model: "project.task", search_view_id: Array[2]…} +auto_refresh: 0 +auto_search: true +context: Class +domain: false +filter: false +flags: Object +groups_id: Array[0] +help: "

Click here to add new tasks

↵ OpenERP's project management allows you to manage the pipeline↵ of tasks in order to get things done efficiently. You can↵ track progress, discuss on tasks, attach documents, etc.↵

↵ " +id: 151 +limit: 80 +multi: false +name: "Tasks" +res_id: 0 +res_model: "project.task" +search_view: "{'name': u'project.task.search.form', 'fields': {'categ_ids': {'domain': [], 'string': 'Tags', 'views': {}, 'm2m_join_columns': ['project_task_id', 'project_category_id'], 'm2m_join_table': 'project_category_project_task_rel', 'relation': 'project.category', 'context': {}, 'selectable': True, 'type': 'many2many'}, 'partner_id': {'domain': [], 'string': 'Customer', 'views': {}, 'relation': 'res.partner', 'context': {}, 'selectable': True, 'type': 'many2one'}, 'user_id': {'domain': [], 'string': 'Assigned to', 'views': {}, 'relation': 'res.users', 'context': {}, 'selectable': True, 'type': 'many2one'}, 'project_id': {'domain': [], 'string': 'Project', 'views': {}, 'relation': 'project.project', 'context': {}, 'selectable': True, 'type': 'many2one', 'select': '1'}, 'stage_id': {'domain': "[('project_ids', '=', project_id)]", 'string': 'Stage', 'views': {}, 'relation': 'project.task.type', 'context': {}, 'selectable': True, 'type': 'many2one'}, 'name': {'string': 'Task Summary', 'views': {}, 'required': True, 'selectable': True, 'type': 'char', 'select': True, 'size': 128}}, 'arch': '\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ', 'model': 'project.task', 'type': u'search', 'view_id': 288, 'field_parent': False}" +search_view_id: Array[2] +src_model: false +target: "current" +type: "ir.actions.act_window" +usage: false +view_id: false +view_ids: Array[0] +view_mode: "kanban,list,form,calendar,gantt,graph" +views: Array[6] +__proto__: Object +*/ + + if (this.field.type === "one2many") { + context["default_" + this.field.relation_field] = this.view.datarecord.id; + } + context["search_default_"+ this.field.relation_field] = [this.view.datarecord.id]; + return this.do_action({ + type: 'ir.actions.act_window', + auto_search: true, + name: this.string, + res_model: this.field.relation, + res_id: val.length >= 1 ? val[0] : false, + res_ids: val, + views: this.options.views, + target: 'current', + context: {}, + }); + }, this)); + }, + val: function() { + var value = this.get("value") || []; + if (value.length >= 1 && value[0] instanceof Array) { + value = value[0][2]; + } + return value; + } +}); + /** * Registry of form fields, called by :js:`instance.web.FormView`. * @@ -5737,6 +5811,7 @@ instance.web.form.widgets = new instance.web.Registry({ 'statusbar': 'instance.web.form.FieldStatus', 'monetary': 'instance.web.form.FieldMonetary', 'many2many_checkboxes': 'instance.web.form.FieldMany2ManyCheckBoxes', + 'x2many_counter': 'instance.web.form.X2ManyCounter', }); /** diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 48c51c4837c..20ee2545cf2 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1947,4 +1947,7 @@ + + + -- cgit v1.2.3 From dc8f0ca96e5e58341f16c6713a08cbcaf210d9d7 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Fri, 4 Oct 2013 17:45:34 +0200 Subject: corrected problems bzr revid: nicolas.vanhoren@openerp.com-20131004154534-b3x46pmbybtza1cs --- addons/web/static/src/js/view_form.js | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 2069a33ab2a..859c78d7217 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -5719,50 +5719,21 @@ instance.web.form.X2ManyCounter = instance.web.form.AbstractField.extend(instanc return this.view.recursive_save().then(_.bind(function() { var val = this.val(); var context = {}; - -/* -Object {groups_id: Array[0], domain: false, help: "

Click here to …documents, etc.↵

↵ ", res_model: "project.task", search_view_id: Array[2]…} -auto_refresh: 0 -auto_search: true -context: Class -domain: false -filter: false -flags: Object -groups_id: Array[0] -help: "

Click here to add new tasks

↵ OpenERP's project management allows you to manage the pipeline↵ of tasks in order to get things done efficiently. You can↵ track progress, discuss on tasks, attach documents, etc.↵

↵ " -id: 151 -limit: 80 -multi: false -name: "Tasks" -res_id: 0 -res_model: "project.task" -search_view: "{'name': u'project.task.search.form', 'fields': {'categ_ids': {'domain': [], 'string': 'Tags', 'views': {}, 'm2m_join_columns': ['project_task_id', 'project_category_id'], 'm2m_join_table': 'project_category_project_task_rel', 'relation': 'project.category', 'context': {}, 'selectable': True, 'type': 'many2many'}, 'partner_id': {'domain': [], 'string': 'Customer', 'views': {}, 'relation': 'res.partner', 'context': {}, 'selectable': True, 'type': 'many2one'}, 'user_id': {'domain': [], 'string': 'Assigned to', 'views': {}, 'relation': 'res.users', 'context': {}, 'selectable': True, 'type': 'many2one'}, 'project_id': {'domain': [], 'string': 'Project', 'views': {}, 'relation': 'project.project', 'context': {}, 'selectable': True, 'type': 'many2one', 'select': '1'}, 'stage_id': {'domain': "[('project_ids', '=', project_id)]", 'string': 'Stage', 'views': {}, 'relation': 'project.task.type', 'context': {}, 'selectable': True, 'type': 'many2one'}, 'name': {'string': 'Task Summary', 'views': {}, 'required': True, 'selectable': True, 'type': 'char', 'select': True, 'size': 128}}, 'arch': '\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ', 'model': 'project.task', 'type': u'search', 'view_id': 288, 'field_parent': False}" -search_view_id: Array[2] -src_model: false -target: "current" -type: "ir.actions.act_window" -usage: false -view_id: false -view_ids: Array[0] -view_mode: "kanban,list,form,calendar,gantt,graph" -views: Array[6] -__proto__: Object -*/ - if (this.field.type === "one2many") { context["default_" + this.field.relation_field] = this.view.datarecord.id; + } else if (this.field.type === "many2many") { + context["default_" + this.field.relation_field] = [6, 0, [this.view.datarecord.id]]; } context["search_default_"+ this.field.relation_field] = [this.view.datarecord.id]; return this.do_action({ type: 'ir.actions.act_window', - auto_search: true, name: this.string, res_model: this.field.relation, res_id: val.length >= 1 ? val[0] : false, res_ids: val, views: this.options.views, target: 'current', - context: {}, + context: context, }); }, this)); }, -- cgit v1.2.3 From 8d2f37ec8bd42d6e593cdbcaec3028cce1730274 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 7 Oct 2013 13:56:38 +0200 Subject: wip bzr revid: nicolas.vanhoren@openerp.com-20131007115638-9b82rw1azwjtp5fr --- addons/web/static/src/js/view_form.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 859c78d7217..06c700eb280 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -5721,19 +5721,16 @@ instance.web.form.X2ManyCounter = instance.web.form.AbstractField.extend(instanc var context = {}; if (this.field.type === "one2many") { context["default_" + this.field.relation_field] = this.view.datarecord.id; - } else if (this.field.type === "many2many") { - context["default_" + this.field.relation_field] = [6, 0, [this.view.datarecord.id]]; } - context["search_default_"+ this.field.relation_field] = [this.view.datarecord.id]; + var domain = [["id", "in", val]]; return this.do_action({ type: 'ir.actions.act_window', name: this.string, res_model: this.field.relation, - res_id: val.length >= 1 ? val[0] : false, - res_ids: val, views: this.options.views, target: 'current', context: context, + domain: domain, }); }, this)); }, -- cgit v1.2.3 From 8b0193a3bc71be75fbfdaf9eff3665ddcfc05a13 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Tue, 8 Oct 2013 15:51:43 +0200 Subject: added doc bzr revid: nicolas.vanhoren@openerp.com-20131008135143-8qjqwi3s23ld0wks --- addons/web/static/src/js/view_form.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 06c700eb280..c096dd884ad 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -5701,6 +5701,17 @@ instance.web.form.FieldMany2ManyCheckBoxes = instance.web.form.AbstractField.ext }, }); +/** + This field can be applied on many2many and one2many. It is a read-only field that will display a single link whose name is + "