From f994797896e767e489b88d3e8644cd95f62d848b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Beltr=C3=A1n?= Date: Fri, 4 May 2012 12:23:03 -0500 Subject: [PATCH 01/21] [FIX]: Bug #942894 This fix the format.js file to make openerp show a count of ids instead the list of them in 2om relationship. lp bug: https://launchpad.net/bugs/942894 fixed bzr revid: wbeltran@infostudio.com.ec-20120504172303-r4pynkj4vofeptk5 --- addons/web/static/src/js/formats.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js index 640ba4d5a93..834a73fac2a 100644 --- a/addons/web/static/src/js/formats.js +++ b/addons/web/static/src/js/formats.js @@ -134,6 +134,10 @@ instance.web.format_value = function (value, descriptor, value_if_empty) { case 'many2one': // name_get value format return value[1]; + case 'one2many': + // this is to show count of ids related in this o2m relation instead the list of them for example will show this:(5) instead of this 1,2,5,8,76 + count_ids='('+value.length.toString()+')' + return count_ids; case 'datetime': if (typeof(value) == "string") value = instance.web.auto_str_to_date(value); From 1e041011fd76d6318f2e6ed1e90fcb3dbec3ada7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Beltr=C3=A1n?= Date: Fri, 4 May 2012 14:30:27 -0500 Subject: [PATCH 02/21] Changes accordig to quality code. bzr revid: wbeltran@infostudio.com.ec-20120504193027-0u94nwfbbitoa2zc --- addons/web/static/src/js/formats.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js index 834a73fac2a..5bb5e461fce 100644 --- a/addons/web/static/src/js/formats.js +++ b/addons/web/static/src/js/formats.js @@ -136,7 +136,7 @@ instance.web.format_value = function (value, descriptor, value_if_empty) { return value[1]; case 'one2many': // this is to show count of ids related in this o2m relation instead the list of them for example will show this:(5) instead of this 1,2,5,8,76 - count_ids='('+value.length.toString()+')' + count_ids = '('+value.length.toString()+')' return count_ids; case 'datetime': if (typeof(value) == "string") From 9e5290e997afff6a9bbfa0096d7b0cd26ec3e102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20Beltr=C3=A1n?= Date: Tue, 15 May 2012 08:24:06 -0500 Subject: [PATCH 03/21] Changed the way of show the result in case of many2many and one2many fields according to xmo@openerp.com tips. bzr revid: wbeltran@infostudio.com.ec-20120515132406-950ekkzyi3nq7jmp --- addons/web/static/src/js/formats.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js index 5bb5e461fce..93126d7b8c9 100644 --- a/addons/web/static/src/js/formats.js +++ b/addons/web/static/src/js/formats.js @@ -135,9 +135,9 @@ instance.web.format_value = function (value, descriptor, value_if_empty) { // name_get value format return value[1]; case 'one2many': - // this is to show count of ids related in this o2m relation instead the list of them for example will show this:(5) instead of this 1,2,5,8,76 - count_ids = '('+value.length.toString()+')' - return count_ids; + return _.str.sprintf(_t("(%d records)"), value.length); + case 'many2many': + return _.str.sprintf(_t("(%d records)"), value.length); case 'datetime': if (typeof(value) == "string") value = instance.web.auto_str_to_date(value); From 43c7472d10d5f9a6f5a452fad097e90d3624a191 Mon Sep 17 00:00:00 2001 From: vishmita Date: Tue, 22 May 2012 11:34:48 +0530 Subject: [PATCH 04/21] [FIX]on_change warning message doesn't displayed. lp bug: https://launchpad.net/bugs/1002166 fixed bzr revid: vja@vja-desktop-20120522060448-lgeza5uzu1wg4vjp --- addons/web/static/src/js/view_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 23e1c9a3ab8..2585d6fe4a5 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -495,7 +495,7 @@ instance.web.FormView = instance.web.View.extend(_.extend({}, instance.web.form. this.on_form_changed(); } if (!_.isEmpty(result.warning)) { - instance.web.dialog($(QWeb.render("CrashManagerWarning", result.warning)), { + instance.web.dialog($(QWeb.render("CrashManager.warning", result.warning)), { modal: true, buttons: [ {text: _t("Ok"), click: function() { $(this).dialog("close"); }} From 248e685deec5572ebf81e0da1ca00ca402d2a0c0 Mon Sep 17 00:00:00 2001 From: vishmita Date: Tue, 22 May 2012 11:58:14 +0530 Subject: [PATCH 05/21] [FIX]put title on dialog. bzr revid: vja@vja-desktop-20120522062814-hem1abedcktkelnu --- addons/web/static/src/js/view_form.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 2585d6fe4a5..841ce4f1f1b 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -496,6 +496,7 @@ instance.web.FormView = instance.web.View.extend(_.extend({}, instance.web.form. } if (!_.isEmpty(result.warning)) { instance.web.dialog($(QWeb.render("CrashManager.warning", result.warning)), { + title:result.warning.title, modal: true, buttons: [ {text: _t("Ok"), click: function() { $(this).dialog("close"); }} From 208eab8418b8983277f01f95daa6669c66392999 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 7 Jun 2012 10:19:17 +0200 Subject: [PATCH 06/21] [FIX] Fix css display issue on field's bzr revid: fme@openerp.com-20120607081917-usplijb44meb1psa --- addons/web/static/src/css/base.css | 2 +- addons/web/static/src/css/base.sass | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index fba01835808..9d2a56be0f7 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1723,7 +1723,7 @@ } .openerp .oe_form .oe_form_field { width: 100%; - display: inline-block; + display: inline-block !important; padding: 2px 2px 2px 0px; line-height: 18px; } diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 10926189ddd..b62ca8c57bd 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1375,7 +1375,8 @@ $colour4: #8a89ba resize: vertical .oe_form_field width: 100% - display: inline-block + // Using !important because jQuery's $.fn.show() will set display to 'inline' for spans + display: inline-block !important padding: 2px 2px 2px 0px line-height: 18px input From 261c85c8267a7a7bc8e3ed0aa8a48659a3174889 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 7 Jun 2012 10:34:44 +0200 Subject: [PATCH 07/21] [IMP] Do not highlight action buttons in editable forms bzr revid: fme@openerp.com-20120607083444-96i7eklva2hj1nee --- addons/web/static/src/css/base.css | 4 ++-- addons/web/static/src/css/base.sass | 35 +++++++++++++++-------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 9d2a56be0f7..1e6b60b4dbf 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1629,7 +1629,7 @@ font-weight: bold; color: #b33630; } -.openerp header.oe_form_topbar_hifirst button:first-child, .openerp button.oe_form_button_hi { +.openerp .oe_form_readonly header.oe_form_topbar_hifirst button:first-child, .openerp .oe_form_readonly button.oe_form_button_hi { color: white; background: #dc5f59; background: -moz-linear-gradient(#dc5f59, #b33630); @@ -1639,7 +1639,7 @@ -webkit-box-shadow: none; -box-shadow: none; } -.openerp header.oe_form_topbar_hifirst button:first-child:hover, .openerp button.oe_form_button_hi:hover { +.openerp .oe_form_readonly header.oe_form_topbar_hifirst button:first-child:hover, .openerp .oe_form_readonly button.oe_form_button_hi:hover { background: #df6b66; background: -moz-linear-gradient(#df6b66, #bf3a33); background: -webkit-gradient(linear, left top, left bottom, from(#df6b66), to(#bf3a33)); diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index b62ca8c57bd..d4902cb7c8a 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1286,23 +1286,24 @@ $colour4: #8a89ba .oe_form_steps_active font-weight: bold color: #b33630 - header.oe_form_topbar_hifirst button:first-child, button.oe_form_button_hi - color: white - background: #DC5F59 - background: -moz-linear-gradient(#DC5F59, #B33630) - background: -webkit-gradient(linear, left top, left bottom, from(#DC5F59), to(#B33630)) - background: -webkit-linear-gradient(#DC5F59, #B33630) - -moz-box-shadow: none - -webkit-box-shadow: none - -box-shadow: none - header.oe_form_topbar_hifirst button:first-child:hover, button.oe_form_button_hi:hover - background: #DF6B66 - background: -moz-linear-gradient( #DF6B66, #BF3A33) - background: -webkit-gradient(linear, left top, left bottom, from( #DF6B66), to( #BF3A33)) - background: -webkit-linear-gradient( #DF6B66, #BF3A33) - -moz-box-shadow: 0 0 1px rgba(0, 0, 0, 0.2) - -webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.2) - -box-shadow: 0 0 1px rgba(0, 0, 0, 0.2) + .oe_form_readonly + header.oe_form_topbar_hifirst button:first-child, button.oe_form_button_hi + color: white + background: #DC5F59 + background: -moz-linear-gradient(#DC5F59, #B33630) + background: -webkit-gradient(linear, left top, left bottom, from(#DC5F59), to(#B33630)) + background: -webkit-linear-gradient(#DC5F59, #B33630) + -moz-box-shadow: none + -webkit-box-shadow: none + -box-shadow: none + header.oe_form_topbar_hifirst button:first-child:hover, button.oe_form_button_hi:hover + background: #DF6B66 + background: -moz-linear-gradient( #DF6B66, #BF3A33) + background: -webkit-gradient(linear, left top, left bottom, from( #DF6B66), to( #BF3A33)) + background: -webkit-linear-gradient( #DF6B66, #BF3A33) + -moz-box-shadow: 0 0 1px rgba(0, 0, 0, 0.2) + -webkit-box-shadow: 0 0 1px rgba(0, 0, 0, 0.2) + -box-shadow: 0 0 1px rgba(0, 0, 0, 0.2) .oe_application .oe_form_sheetbg background: url(/web/static/src/img/form_sheetbg.png) From afd1f6bfe9b27e73dd7af0e45cef515b5005facc Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 7 Jun 2012 10:54:51 +0200 Subject: [PATCH 08/21] [FIX] Fixed global click bzr revid: fme@openerp.com-20120607085451-btmj2plke1gt5j49 --- addons/web_kanban/static/src/js/kanban.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 67aa39f8232..4d3f09cec71 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -632,7 +632,9 @@ instance.web_kanban.KanbanRecord = instance.web.OldWidget.extend({ return false; }); - this.$element.find('.oe_kanban_global_click').on('click', this.on_card_clicked); + if (this.$element.find('.oe_kanban_global_click').length) { + this.$element.on('click', this.on_card_clicked); + } }, on_card_clicked: function() { this.view.trigger('hide_menus'); From 79faa84586a3fb7e60cf9d086b7a8229edbb6d9e Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 7 Jun 2012 11:29:02 +0200 Subject: [PATCH 09/21] [IMP] Sidebar dropdown menu styling bzr revid: fme@openerp.com-20120607092902-oqm33eqmtoirnnb6 --- addons/web/static/src/css/base.css | 2 +- addons/web/static/src/css/base.sass | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 1e6b60b4dbf..2988c0aa634 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1123,7 +1123,7 @@ left: 0px; padding: 8px; border: 1px solid #afafb6; - width: 120px; + min-width: 120px; overflow-x: hidden; z-index: 900; text-align: left; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index d4902cb7c8a..df40fc8d151 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -895,7 +895,7 @@ $colour4: #8a89ba left: 0px padding: 8px border: 1px solid #afafb6 - width: 120px + min-width: 120px overflow-x: hidden z-index: 900 text-align: left From 4a5e539042f08d08abb2406dbec75234de59850f Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 7 Jun 2012 12:41:23 +0200 Subject: [PATCH 10/21] [fix] problem with notebooks, does not change current tab when it is switching to invisible bzr revid: nicolas.vanhoren@openerp.com-20120607104123-tm7bgjt91m771die --- addons/web/static/src/js/view_form.js | 35 ++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 43094a97e66..7ef06540b5e 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1191,19 +1191,40 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt var $page = $(this); var page_attrs = $page.getAttributes(); page_attrs.id = _.uniqueId('notebook_page_'); - pages.push(page_attrs); var $new_page = self.render_element('FormRenderingNotebookPage', page_attrs); $page.contents().appendTo($new_page); $page.before($new_page).remove(); - self.handle_common_properties($new_page, $page); + var ic = self.handle_common_properties($new_page, $page).invisibility_changer; + page_attrs.__page = $new_page; + page_attrs.__ic = ic; + pages.push(page_attrs); + + $new_page.children().each(function() { + self.process($(this)); + }); }); var $new_notebook = this.render_element('FormRenderingNotebook', { pages : pages }); $notebook.contents().appendTo($new_notebook); $notebook.before($new_notebook).remove(); - $new_notebook.children().each(function() { - self.process($(this)); - }); + self.process($($new_notebook.children()[0])); + //tabs and invisibility handling $new_notebook.tabs(); + _.each(pages, function(page, i) { + if (! page.__ic) + return; + page.__ic.on("change:effective_invisible", null, function() { + var current = $new_notebook.tabs("option", "selected"); + if (! pages[current].__ic || ! pages[current].__ic.get("effective_invisible")) + return; + var first_visible = _.find(_.range(pages.length), function(i2) { + return (! pages[i2].__ic) || (! pages[i2].__ic.get("effective_invisible")); + }); + if (first_visible !== undefined) { + $new_notebook.tabs('select', first_visible); + } + }); + }); + this.handle_common_properties($new_notebook, $notebook); return $new_notebook; }, @@ -1241,10 +1262,12 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt handle_common_properties: function($new_element, $node) { var str_modifiers = $node.attr("modifiers") || "{}" var modifiers = JSON.parse(str_modifiers); + var ic = null; if (modifiers.invisible !== undefined) - new instance.web.form.InvisibilityChanger(this.view, this.view, modifiers.invisible, $new_element); + ic = new instance.web.form.InvisibilityChanger(this.view, this.view, modifiers.invisible, $new_element); $new_element.addClass($node.attr("class") || ""); $new_element.attr('style', $node.attr('style')); + return {invisibility_changer: ic,}; }, }); From 193a238c85db46a3d04f8c28b9c514b9648fabcd Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 7 Jun 2012 14:26:28 +0200 Subject: [PATCH 11/21] [fix] problem in analytic accounts, old colors expression not compatible with web client 6.1 bzr revid: nicolas.vanhoren@openerp.com-20120607122628-l9p52qj5fk79rut9 --- .../account_analytic_default/account_analytic_default_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_analytic_default/account_analytic_default_view.xml b/addons/account_analytic_default/account_analytic_default_view.xml index 8b601022de4..886d4b54c0d 100644 --- a/addons/account_analytic_default/account_analytic_default_view.xml +++ b/addons/account_analytic_default/account_analytic_default_view.xml @@ -6,7 +6,7 @@ account.analytic.default tree - + From c04b75fb5358929fd8e3c189828292468081885f Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 7 Jun 2012 15:02:31 +0200 Subject: [PATCH 12/21] [ADD] Add support for @modifiers in kanban views bzr revid: fme@openerp.com-20120607130231-i4lovbubmq9vevwb --- addons/web_kanban/static/src/js/kanban.js | 40 ++++++++++++++--------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 4d3f09cec71..6a84f65067e 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -109,11 +109,23 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ } }, transform_qweb_template: function(node) { - var qweb_prefix = QWeb.prefix; + var qweb_add_if = function(node, condition) { + if (node.attrs[QWeb.prefix + '-if']) { + condition = _.str.sprintf("(%s) and (%s)", node.attrs[QWeb.prefix + '-if'], condition); + } + node.attrs[QWeb.prefix + '-if'] = condition; + }; + // Process modifiers + if (node.tag && node.attrs.modifiers) { + var modifiers = JSON.parse(node.attrs.modifiers || '{}'); + if (modifiers.invisible) { + qweb_add_if(node, _.str.sprintf("!kanban_compute_domain(%s)", JSON.stringify(modifiers.invisible))); + } + } switch (node.tag) { case 'field': - node.tag = qweb_prefix; - node.attrs[qweb_prefix + '-esc'] = 'record.' + node.attrs['name'] + '.value'; + node.tag = QWeb.prefix; + node.attrs[QWeb.prefix + '-esc'] = 'record.' + node.attrs['name'] + '.value'; this.extract_aggregates(node); break; case 'button': @@ -126,18 +138,6 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ delete(node.attrs[k]); } }); - if (node.attrs['data-states']) { - var states = _.map(node.attrs['data-states'].split(','), function(state) { - return "record.state.raw_value == '" + _.str.trim(state) + "'"; - }); - node.attrs[qweb_prefix + '-if'] = states.join(' or '); - } - if (node.attrs['data-kanban_states']) { - var states = _.map(node.attrs['data-kanban_states'].split(','), function(state) { - return "record.kanban_state.raw_value == '" + _.str.trim(state) + "'"; - }); - node.attrs[qweb_prefix + '-if'] = states.join(' or '); - } if (node.attrs['data-string']) { node.attrs.title = node.attrs['data-string']; } @@ -530,7 +530,14 @@ instance.web_kanban.KanbanRecord = instance.web.OldWidget.extend({ this.state = this.view.state.records[this.id]; }, set_record: function(record) { + var self = this; this.id = record.id; + this.values = {}; + _.each(record, function(v, k) { + self.values[k] = { + value: v + }; + }); this.record = this.transform_record(record); }, start: function() { @@ -751,6 +758,9 @@ instance.web_kanban.KanbanRecord = instance.web.OldWidget.extend({ } else { return s.substr(0, size) + '...'; } + }, + kanban_compute_domain: function(domain) { + return instance.web.form.compute_domain(domain, this.values); } }); From 855854837cfc6cace2025610baa54ae3b9d41bfe Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 7 Jun 2012 15:12:44 +0200 Subject: [PATCH 13/21] [IMP] @kanban_states replaced by @attrs. Kanban views now support @modifiers. bzr revid: fme@openerp.com-20120607131244-nc20un5t1wg1jmip --- addons/project/project_view.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index b9d90bcd21a..853c1e49dce 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -479,9 +479,9 @@
From 53d4fcad83ffed5cc79a89a88f8e5e721fca0a9d Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 7 Jun 2012 15:54:12 +0200 Subject: [PATCH 14/21] [FIX] problem with ir.actions.url in some cases lp bug: https://launchpad.net/bugs/1003923 fixed bzr revid: nicolas.vanhoren@openerp.com-20120607135412-0uzquukg21pbm492 --- addons/web/controllers/main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 6eb8ed94909..1ccba0c9867 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1467,6 +1467,10 @@ class Binary(openerpweb.Controller): class Action(openerpweb.Controller): _cp_path = "/web/action" + + action_mapping = { + "ir.actions.act_url": "ir.actions.url", + } @openerpweb.jsonrequest def load(self, req, action_id, do_not_eval=False): @@ -1479,7 +1483,9 @@ class Action(openerpweb.Controller): if action_type[0]['type'] == 'ir.actions.report.xml': ctx.update({'bin_size': True}) ctx.update(context) - action = req.session.model(action_type[0]['type']).read([action_id], False, ctx) + action_model = action_type[0]['type'] + action_model = Action.action_mapping.get(action_model, action_model) + action = req.session.model(action_model).read([action_id], False, ctx) if action: value = clean_action(req, action[0], do_not_eval) return {'result': value} From 45fc9bba23f03479e8ada9276c830d4a8fa9a308 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 7 Jun 2012 16:07:25 +0200 Subject: [PATCH 15/21] [ADD] Add classname for Form's invisible widgets bzr revid: fme@openerp.com-20120607140725-qrvmvd7bvgdwnxos --- addons/web/static/src/css/base.css | 14 +++++++------- addons/web/static/src/css/base.sass | 16 ++++++++-------- addons/web/static/src/js/view_form.js | 6 +----- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 2988c0aa634..5ef56c69797 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1629,7 +1629,7 @@ font-weight: bold; color: #b33630; } -.openerp .oe_form_readonly header.oe_form_topbar_hifirst button:first-child, .openerp .oe_form_readonly button.oe_form_button_hi { +.openerp .oe_form_readonly button.oe_form_button_hi { color: white; background: #dc5f59; background: -moz-linear-gradient(#dc5f59, #b33630); @@ -1639,7 +1639,7 @@ -webkit-box-shadow: none; -box-shadow: none; } -.openerp .oe_form_readonly header.oe_form_topbar_hifirst button:first-child:hover, .openerp .oe_form_readonly button.oe_form_button_hi:hover { +.openerp .oe_form_readonly button.oe_form_button_hi:hover { background: #df6b66; background: -moz-linear-gradient(#df6b66, #bf3a33); background: -webkit-gradient(linear, left top, left bottom, from(#df6b66), to(#bf3a33)); @@ -1667,13 +1667,13 @@ -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); -box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); } +.openerp .oe_form_invisible { + display: none; +} .openerp .oe_form_editable .oe_form_editable_hidden { display: none; } -.openerp .oe_form_readonly .oe_form_readonly_hidden { - display: none; -} -.openerp .oe_form_readonly .oe_form_field:empty { +.openerp .oe_form_readonly .oe_form_readonly_hidden, .openerp .oe_form_readonly .oe_form_field:empty { display: none; } .openerp .oe_form .oe_form_field_text { @@ -1723,7 +1723,7 @@ } .openerp .oe_form .oe_form_field { width: 100%; - display: inline-block !important; + display: inline-block; padding: 2px 2px 2px 0px; line-height: 18px; } diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index df40fc8d151..c4d9d565b8b 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1287,7 +1287,7 @@ $colour4: #8a89ba font-weight: bold color: #b33630 .oe_form_readonly - header.oe_form_topbar_hifirst button:first-child, button.oe_form_button_hi + button.oe_form_button_hi color: white background: #DC5F59 background: -moz-linear-gradient(#DC5F59, #B33630) @@ -1296,7 +1296,7 @@ $colour4: #8a89ba -moz-box-shadow: none -webkit-box-shadow: none -box-shadow: none - header.oe_form_topbar_hifirst button:first-child:hover, button.oe_form_button_hi:hover + button.oe_form_button_hi:hover background: #DF6B66 background: -moz-linear-gradient( #DF6B66, #BF3A33) background: -webkit-gradient(linear, left top, left bottom, from( #DF6B66), to( #BF3A33)) @@ -1321,12 +1321,13 @@ $colour4: #8a89ba @include box-shadow(0 0 10px rgba(0,0,0,0.3)) // }}} // FormView.layout {{{ + .oe_form_invisible + display: none .oe_form_editable .oe_form_editable_hidden display: none - .oe_form_readonly .oe_form_readonly_hidden - display: none - .oe_form_readonly .oe_form_field:empty - display: none + .oe_form_readonly + .oe_form_readonly_hidden, .oe_form_field:empty + display: none .oe_form .oe_form_field_text width: 100% @@ -1376,8 +1377,7 @@ $colour4: #8a89ba resize: vertical .oe_form_field width: 100% - // Using !important because jQuery's $.fn.show() will set display to 'inline' for spans - display: inline-block !important + display: inline-block padding: 2px 2px 2px 0px line-height: 18px input diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index a2d065e40b4..b8ea69d1c35 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1410,11 +1410,7 @@ instance.web.form.InvisibilityChangerMixin = { this._check_visibility(); }, _check_visibility: function() { - if (this.get("effective_invisible")) { - this.$element.hide(); - } else { - this.$element.show(); - } + this.$element.toggleClass('oe_form_invisible', this.get("effective_invisible")); }, }; From d1018bb03167232eaa25a114431d343316d545d2 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 7 Jun 2012 16:19:30 +0200 Subject: [PATCH 16/21] [FIX] problem with m2m and default values lp bug: https://launchpad.net/bugs/997019 fixed bzr revid: nicolas.vanhoren@openerp.com-20120607141930-f9q4gg88d0fe9yyq --- addons/web/static/src/js/view_form.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index b8ea69d1c35..a87ff502d94 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3287,6 +3287,9 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({ self.reload_content(); this.is_setted.resolve(); }, + get_value: function() { + return [commands.replace_with(this.get('value'))]; + }, load_view: function() { var self = this; this.list_view = new instance.web.form.Many2ManyListView(this, this.dataset, false, { @@ -3316,7 +3319,7 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({ }); }, dataset_changed: function() { - this.set({'value': [commands.replace_with(this.dataset.ids)]}); + this.set({'value': this.dataset.ids}); }, }); From 6e08596d2a1856a763322a48657b86cd696f438d Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 7 Jun 2012 16:31:04 +0200 Subject: [PATCH 17/21] [FIX] Some fields won't be marked as invalid upon save bzr revid: fme@openerp.com-20120607143104-uzjpid04jtwvctw8 --- addons/web/static/src/js/view_form.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index a87ff502d94..1c622933c1d 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -643,6 +643,9 @@ instance.web.FormView = instance.web.View.extend(_.extend({}, instance.web.form. } if (form_invalid) { self.set({'display_invalid_fields': true}); + for (var f in self.fields) { + self.fields[f]._check_css_flags(); + } first_invalid_field.focus(); self.on_invalid(); return $.Deferred().reject(); @@ -1899,7 +1902,7 @@ instance.web.form.FieldChar = instance.web.form.AbstractField.extend(_.extend({} return true; }, is_false: function() { - return this.get('value') === ''; + return this.get('value') === '' || this._super(); }, focus: function() { this.delay_focus(this.$element.find('input:first')); @@ -2108,7 +2111,7 @@ instance.web.form.FieldDatetime = instance.web.form.AbstractField.extend(_.exten return true; }, is_false: function() { - return this.get('value') === ''; + return this.get('value') === '' || this._super(); }, focus: function() { if (this.datewidget && this.datewidget.$input) @@ -2158,7 +2161,7 @@ instance.web.form.FieldText = instance.web.form.AbstractField.extend(_.extend({} return true; }, is_false: function() { - return this.get('value') === ''; + return this.get('value') === '' || this._super(); }, focus: function($element) { this.delay_focus(this.$textarea); From 9e18a2ba9f2a8a1c1bfc8af56fd3d1a690f93dd7 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 7 Jun 2012 16:33:19 +0200 Subject: [PATCH 18/21] [IMP] Add 'Switch to' to view switcher's tooltips bzr revid: fme@openerp.com-20120607143319-phnj75kmpthimtbk --- addons/web/static/src/xml/base.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index a1c7a2c9720..3764395dc13 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -424,7 +424,7 @@
From a6a4f8e752efbfcfa5d68cec39bf2ecea805c133 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 7 Jun 2012 16:39:26 +0200 Subject: [PATCH 19/21] [MOV] Moved SideBar 'import' and 'export' to list view only bzr revid: fme@openerp.com-20120607143926-a0p7quqguz130iwd --- addons/web/static/src/js/view_list.js | 2 ++ addons/web/static/src/js/views.js | 7 ++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 081c4444a72..81654534c26 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -339,6 +339,8 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi this.sidebar = new instance.web.Sidebar(this); this.sidebar.appendTo(this.options.$sidebar); this.sidebar.add_items('other', [ + { label: _t("Import"), callback: this.on_sidebar_import }, + { label: _t("Export"), callback: this.on_sidebar_export }, { label: _t('Delete'), callback: this.do_delete_selected }, ]); this.sidebar.add_toolbar(this.fields_view.toolbar); diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index b97ed94990b..32936518028 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -706,11 +706,8 @@ instance.web.Sidebar = instance.web.Widget.extend({ this.items = { 'print' : [], 'files' : [], - 'other' : [ - { label: _t("Import"), callback: view.on_sidebar_import }, - { label: _t("Export"), callback: view.on_sidebar_export } - ] - } + 'other' : [] + }; if (this.session.uid === 1) { var item = { label: _t("Translate"), callback: view.on_sidebar_translate, title: _t("Technical translation") }; this.items.other.push(item); From 55bbd5f29053a7ef3b0a7869d7038e4ed602de24 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 7 Jun 2012 16:49:35 +0200 Subject: [PATCH 20/21] [IMP] Hide Sidebar section when item list is empty bzr revid: fme@openerp.com-20120607144935-csiijcfoir2z362o --- addons/web/static/src/js/views.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 32936518028..01297e70bb1 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -743,6 +743,11 @@ instance.web.Sidebar = instance.web.Widget.extend({ var self = this; self.$element.html(QWeb.render('Sidebar', {widget: self})); this.$element.find('ul').hide(); + + // Hides Sidebar sections when item list is empty + this.$('.oe_form_dropdown_section').each(function() { + $(this).toggle(!!$(this).find('li').length); + }); }, /** * For each item added to the section: From eb7b8c8fcb342377fc4f8f3c1884116157e17ad8 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 7 Jun 2012 16:59:10 +0200 Subject: [PATCH 21/21] [FIX] code problem in mrp_repair bzr revid: nicolas.vanhoren@openerp.com-20120607145910-ufeudfxryz4v6pgt --- addons/mrp_repair/mrp_repair.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index 7d78fb46490..6f14ba22bea 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -230,10 +230,9 @@ class mrp_repair(osv.osv): data['value']['location_id'] = move.location_dest_id.id data['value']['location_dest_id'] = move.location_dest_id.id if move.partner_id: - data['value']['partner_id'] = move.partner_id and move.partner_id.id + data['value']['partner_id'] = move.partner_id.id else: data['value']['partner_id'] = False - data['value']['partner_id'] = move.partner_id and move.partner_id.id d = self.onchange_partner_id(cr, uid, ids, data['value']['partner_id'], data['value']['partner_id']) data['value'].update(d['value']) return data