From 43c7472d10d5f9a6f5a452fad097e90d3624a191 Mon Sep 17 00:00:00 2001 From: vishmita Date: Tue, 22 May 2012 11:34:48 +0530 Subject: [PATCH 01/16] [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 02/16] [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 4a5e539042f08d08abb2406dbec75234de59850f Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 7 Jun 2012 12:41:23 +0200 Subject: [PATCH 03/16] [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 04/16] [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 05/16] [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 06/16] [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 07/16] [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 08/16] [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 09/16] [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 10/16] [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 11/16] [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 12/16] [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 13/16] [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 14/16] [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 From c7e32e7175ffbee3f0b9b0031a8cb773b268858b Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 7 Jun 2012 17:23:01 +0200 Subject: [PATCH 15/16] [FIX] Problem with SelectCreatePopup, the list view can sometimes be editable lp bug: https://launchpad.net/bugs/1005812 fixed bzr revid: nicolas.vanhoren@openerp.com-20120607152301-mu43z3n7q2fonsuk --- addons/web/static/src/js/view_form.js | 3 ++- addons/web/static/src/js/view_list.js | 3 +++ addons/web/static/src/js/view_list_editable.js | 5 ++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 1c622933c1d..2e170dfa646 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3777,7 +3777,8 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend self.view_list = new instance.web.form.SelectCreateListView(self, self.dataset, false, _.extend({'deletable': false, - 'selectable': !self.options.disable_multiple_selection + 'selectable': !self.options.disable_multiple_selection, + 'read_only': true, }, self.options.list_view_options || {})); self.view_list.popup = self; self.view_list.appendTo($(".oe-select-create-popup-view-list", self.$element)).pipe(function() { diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 81654534c26..de73ec21884 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -21,6 +21,9 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi // whether the view rows can be reordered (via vertical drag & drop) 'reorderable': true, 'action_buttons': true, + // if true, the view can't be editable, ignoring the view's and the context's + // instructions + 'read_only': false, }, /** * Core class for list-type displays. diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index 84074c17e5e..c80509a7b2b 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -54,8 +54,7 @@ openerp.web.list_editable = function (instance) { // view' @editable is handled separately as we have not yet // fetched and processed the view at this point. this.options.editable = ( - (force && "bottom") - || this.defaults.editable); + ! this.options.read_only && ((force && "bottom") || this.defaults.editable)); }, /** * Replace do_search to handle editability process @@ -79,7 +78,7 @@ openerp.web.list_editable = function (instance) { }, on_loaded: function (data, grouped) { // tree/@editable takes priority on everything else if present. - this.options.editable = data.arch.attrs.editable || this.options.editable; + this.options.editable = ! this.options.read_only && (data.arch.attrs.editable || this.options.editable); return this._super(data, grouped); }, /** From 0cc5148b8c64b6540221cca7a10d222bed91dff9 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 7 Jun 2012 18:08:01 +0200 Subject: [PATCH 16/16] [ADD] Add 'options' to do_switch_view() piped to do_show() bzr revid: fme@openerp.com-20120607160801-z86cgeo00epiyq61 --- addons/web/static/src/js/view_form.js | 6 +++++- addons/web/static/src/js/views.js | 12 ++++++------ addons/web_kanban/static/src/js/kanban.js | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 2e170dfa646..64381a66218 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -208,8 +208,9 @@ instance.web.FormView = instance.web.View.extend(_.extend({}, instance.web.form. } } }, - do_show: function () { + do_show: function (options) { var self = this; + options = options || {}; if (this.sidebar) { this.sidebar.$element.show(); } @@ -233,6 +234,9 @@ instance.web.FormView = instance.web.View.extend(_.extend({}, instance.web.form. }).pipe(self.on_record_loaded); } result.pipe(function() { + if (options.editable) { + self.set({mode: "edit"}); + } self.$element.css('visibility', 'visible'); }); return result; diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 01297e70bb1..753e14fa251 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -267,7 +267,7 @@ instance.web.ViewManager = instance.web.Widget.extend({ * @param {Boolean} [no_store=false] don't store the view being switched to on the switch stack * @returns {jQuery.Deferred} new view loading promise */ - on_mode_switch: function(view_type, no_store) { + on_mode_switch: function(view_type, no_store, view_options) { var self = this; var view = this.views[view_type]; var view_promise; @@ -330,7 +330,7 @@ instance.web.ViewManager = instance.web.Widget.extend({ var controller = self.views[view_name].controller; if (controller) { if (view_name === view_type) { - controller.do_show(); + controller.do_show(view_options || {}); } else { controller.do_hide(); } @@ -347,8 +347,8 @@ instance.web.ViewManager = instance.web.Widget.extend({ * to be extended by child classes to change the default behavior, which simply * consist to switch to the asked view. */ - switch_view: function(view_type, no_store) { - return this.on_mode_switch(view_type, no_store); + switch_view: function(view_type, no_store, options) { + return this.on_mode_switch(view_type, no_store, options); }, /** * Returns to the view preceding the caller view in this manager's @@ -651,10 +651,10 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({ }, action || {}); this.do_action(action); }, - on_mode_switch: function (view_type, no_store) { + on_mode_switch: function (view_type, no_store, options) { var self = this; - return $.when(this._super(view_type, no_store)).then(function () { + return $.when(this._super.apply(this, arguments)).then(function () { var controller = self.views[self.active_view].controller, fvg = controller.fields_view, view_id = (fvg && fvg.view_id) || '--'; diff --git a/addons/web_kanban/static/src/js/kanban.js b/addons/web_kanban/static/src/js/kanban.js index 6a84f65067e..7e3d8c10e6b 100644 --- a/addons/web_kanban/static/src/js/kanban.js +++ b/addons/web_kanban/static/src/js/kanban.js @@ -325,7 +325,7 @@ instance.web_kanban.KanbanView = instance.web.View.extend({ }, open_record: function(id) { if (this.dataset.select_id(id)) { - this.do_switch_view('form'); + this.do_switch_view('form', null, { editable: true }); } else { this.do_warn("Kanban: could not find id#" + id); }