From 3eb5cfb61b6bbb84043f4fa6b3fdefb0fbb320c7 Mon Sep 17 00:00:00 2001 From: "Vidhin Mehta (OpenERP)" Date: Wed, 3 Oct 2012 16:52:27 +0530 Subject: [PATCH 01/11] [IMP]remove call_backs from call method. bzr revid: vme@tinyerp.com-20121003112227-vu2crilmvnk2me8j --- addons/google_docs/static/src/js/gdocs.js | 8 ++++---- addons/process/static/src/js/process.js | 3 +-- addons/share/static/src/js/share.js | 5 ++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js index bcfd24f8c0d..2aafdd3de4b 100644 --- a/addons/google_docs/static/src/js/gdocs.js +++ b/addons/google_docs/static/src/js/gdocs.js @@ -22,7 +22,7 @@ var _t = instance.web._t; var form = self.getParent(); form.sidebar_context().then(function (context) { var ds = new instance.web.DataSet(this, 'ir.attachment', context); - ds.call('google_doc_get', [form.dataset.model, [form.datarecord.id], context], function(r) { + ds.call('google_doc_get', [form.dataset.model, [form.datarecord.id], context]).then(function(r) { if (r == 'False') { var params = { error: response, @@ -35,7 +35,7 @@ var _t = instance.web._t; } form.reload(); }); - }) + }); } - }) -} + }); +}; diff --git a/addons/process/static/src/js/process.js b/addons/process/static/src/js/process.js index 57c6f196012..2b543484f2e 100644 --- a/addons/process/static/src/js/process.js +++ b/addons/process/static/src/js/process.js @@ -217,8 +217,7 @@ instance.web.ViewManager.include({ var dataset = new instance.web.DataSet(this, 'ir.values', this.session.user_context); var action_manager = new instance.web.ActionManager(self); dataset.call('get', - ['action', 'tree_but_open',[['ir.ui.menu', id]], dataset.context], - function(res) { + ['action', 'tree_but_open',[['ir.ui.menu', id]], dataset.context]).then(function(res) { var action = res[0][res[0].length - 1]; self.rpc("/web/action/load", { action_id: action.id, diff --git a/addons/share/static/src/js/share.js b/addons/share/static/src/js/share.js index bab3cac243f..01c1ef0a41e 100644 --- a/addons/share/static/src/js/share.js +++ b/addons/share/static/src/js/share.js @@ -24,9 +24,8 @@ openerp.share = function(session) { user_type: user_type || 'embedded', view_type: view.fields_view.type, invite: invite || false, - }, function(result) { - var share_id = result.result; - var step1 = Share.call('go_step_1', [[share_id],], function(result) { + }).then(function(share_id) { + var step1 = Share.call('go_step_1', [[share_id]]).then(function(result) { var action = result; self.do_action(action); }); From 1fe81f3a962cf1600a9aecbb22d7be9162c3a311 Mon Sep 17 00:00:00 2001 From: ggh-openerp Date: Wed, 3 Oct 2012 18:04:12 +0530 Subject: [PATCH 02/11] [IMP] In rpc method remove callback and modify related code bzr revid: ggh@tinyerp.com-20121003123412-22o4t380ipsmns2e --- .../account/static/src/js/account_move_reconciliation.js | 2 +- addons/auth_openid/static/src/js/auth_openid.js | 4 ++-- addons/board/static/src/js/dashboard.js | 6 +++--- addons/edi/static/src/js/edi.js | 6 +++--- addons/mail/static/src/js/mail.js | 2 +- addons/point_of_sale/static/src/js/devices.js | 7 +++---- addons/process/static/src/js/process.js | 2 +- addons/share/static/src/js/share.js | 2 +- addons/web_shortcuts/static/src/js/web_shortcuts.js | 4 ++-- 9 files changed, 17 insertions(+), 18 deletions(-) diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js index 6b007e2f097..18e415a5f0a 100644 --- a/addons/account/static/src/js/account_move_reconciliation.js +++ b/addons/account/static/src/js/account_move_reconciliation.js @@ -101,7 +101,7 @@ openerp.account = function (instance) { return self.rpc("/web/action/load", { action_id: result[1], context: additional_context - }, function (result) { + }).then(function (result) { result = result.result; result.context = _.extend(result.context || {}, additional_context); result.flags = result.flags || {}; diff --git a/addons/auth_openid/static/src/js/auth_openid.js b/addons/auth_openid/static/src/js/auth_openid.js index 70739e056ed..56ec5b57d3f 100644 --- a/addons/auth_openid/static/src/js/auth_openid.js +++ b/addons/auth_openid/static/src/js/auth_openid.js @@ -69,7 +69,7 @@ instance.web.Login = instance.web.Login.extend({ _check_error: function() { var self = this; if (this.params.loginerror !== undefined) { - this.rpc('/auth_openid/login/status', {}, function(result) { + this.rpc('/auth_openid/login/status', {}).then(function(result) { if (_.contains(['success', 'failure'], result.status) && result.message) { self.do_warn('Invalid OpenID Login', result.message); } @@ -106,7 +106,7 @@ instance.web.Login = instance.web.Login.extend({ do_openid_login: function(db, openid_url) { var self = this; - this.rpc('/auth_openid/login/verify', {'db': db, 'url': openid_url}, function(result) { + this.rpc('/auth_openid/login/verify', {'db': db, 'url': openid_url}).then(function(result) { if (result.error) { self.do_warn(result.title, result.error); return; diff --git a/addons/board/static/src/js/dashboard.js b/addons/board/static/src/js/dashboard.js index 43d7ca76d39..e2d4d6246ab 100644 --- a/addons/board/static/src/js/dashboard.js +++ b/addons/board/static/src/js/dashboard.js @@ -46,7 +46,7 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({ delete(action.attrs.colspan); var action_id = _.str.toNumber(action.attrs.name); if (!_.isNaN(action_id)) { - self.rpc('/web/action/load', {action_id: action_id}, function(result) { + self.rpc('/web/action/load', {action_id: action_id}).then(function(result) { self.on_load_action(result, column_index + '_' + action_index, action.attrs); }); } @@ -81,7 +81,7 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({ this.rpc('/web/view/undo_custom', { view_id: this.view.fields_view.view_id, reset: true - }, this.do_reload); + }).then(this.do_reload); }, on_change_layout: function() { var self = this; @@ -382,7 +382,7 @@ instance.board.AddToDashboard = instance.web.search.Input.extend({ domain: domain, view_mode: view_parent.active_view, name: this.$el.find("input").val() - }, function(r) { + }).then(function(r) { if (r === false) { self.do_warn("Could not add filter to dashboard"); } else { diff --git a/addons/edi/static/src/js/edi.js b/addons/edi/static/src/js/edi.js index abb6d9a6232..4089318f3ce 100644 --- a/addons/edi/static/src/js/edi.js +++ b/addons/edi/static/src/js/edi.js @@ -15,7 +15,7 @@ openerp.edi.EdiView = openerp.web.Widget.extend({ this._super(); var self = this; var param = {"db": self.db, "token": self.token}; - return self.rpc('/edi/get_edi_document', param, this.on_document_loaded, this.on_document_failed); + return self.rpc('/edi/get_edi_document', param).done(this.on_document_loaded), fail(this.on_document_failed); }, on_document_loaded: function(docs){ this.doc = docs[0]; @@ -149,11 +149,11 @@ openerp.edi.EdiImport = openerp.web.Widget.extend({ }, do_import: function() { - this.rpc('/edi/import_edi_url', {url: this.url}, this.on_imported, this.on_imported_error); + this.rpc('/edi/import_edi_url', {url: this.url}),done(this.on_imported), fail(this.on_imported_error); }, on_imported: function(response) { if ('action' in response) { - this.rpc("/web/session/save_session_action", {the_action: response.action}, function(key) { + this.rpc("/web/session/save_session_action", {the_action: response.action}).then(function(key) { window.location = "/#sa="+encodeURIComponent(key); }); } diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index e0c9ac9b7fc..0ee3e6b1144 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -1127,7 +1127,7 @@ openerp.mail = function(session) { domains: domains || [], contexts: contexts || [], group_by_seq: groupbys || [] - }, function (results) { + }).then(function (results) { self.search_results['context'] = results.context; self.search_results['domain'] = results.domain; self.thread.destroy(); diff --git a/addons/point_of_sale/static/src/js/devices.js b/addons/point_of_sale/static/src/js/devices.js index 142d35bd340..9b38c7f72f0 100644 --- a/addons/point_of_sale/static/src/js/devices.js +++ b/addons/point_of_sale/static/src/js/devices.js @@ -37,11 +37,10 @@ function openerp_pos_devices(instance,module){ //module is instance.point_of_sal callbacks[i](params); } - this.connection.rpc('/pos/'+name, params || {}, - function(result){ + this.connection.rpc('/pos/'+name, params || {}).done(function(result){ ret.resolve(result); - }, - function(error){ + }), + fail(function(error){ ret.reject(error); }); return ret; diff --git a/addons/process/static/src/js/process.js b/addons/process/static/src/js/process.js index 57c6f196012..b13e92df33c 100644 --- a/addons/process/static/src/js/process.js +++ b/addons/process/static/src/js/process.js @@ -223,7 +223,7 @@ instance.web.ViewManager.include({ self.rpc("/web/action/load", { action_id: action.id, context: dataset.context - }, function(result) { + }).then(function(result) { action_manager.replace(self.$el); action_manager.do_action(result.result); }) diff --git a/addons/share/static/src/js/share.js b/addons/share/static/src/js/share.js index bab3cac243f..83eab6afaf2 100644 --- a/addons/share/static/src/js/share.js +++ b/addons/share/static/src/js/share.js @@ -15,7 +15,7 @@ openerp.share = function(session) { self.rpc('/web/session/eval_domain_and_context', { domains: [domain], contexts: [view.dataset.context] - }, function (result) { + }).then(function (result) { Share.create({ name: action.name, record_name: rec_name, diff --git a/addons/web_shortcuts/static/src/js/web_shortcuts.js b/addons/web_shortcuts/static/src/js/web_shortcuts.js index 743f3fc73aa..06b8fe35f73 100644 --- a/addons/web_shortcuts/static/src/js/web_shortcuts.js +++ b/addons/web_shortcuts/static/src/js/web_shortcuts.js @@ -46,7 +46,7 @@ instance.web_shortcuts.Shortcuts = instance.web.Widget.extend({ load: function() { var self = this; this.$el.find('.oe_systray_shortcuts_items').empty(); - return this.rpc('/web/shortcuts/list', {}, function(shortcuts) { + return this.rpc('/web/shortcuts/list', {}).then(function(shortcuts) { _.each(shortcuts, function(sc) { self.trigger('display', sc); }); @@ -80,7 +80,7 @@ instance.web_shortcuts.Shortcuts = instance.web.Widget.extend({ id = $link.data('id'); self.session.active_id = id; // TODO: Use do_action({menu_id: id, type: 'ir.actions.menu'}) - self.rpc('/web/menu/action', {'menu_id': id}, function(ir_menu_data) { + self.rpc('/web/menu/action', {'menu_id': id}).then(function(ir_menu_data) { if (ir_menu_data.action.length){ instance.webclient.user_menu.on_action({action_id: ir_menu_data.action[0][2].id}); } From dd747c096299dbee5f30468541639c8f08081151 Mon Sep 17 00:00:00 2001 From: "Vidhin Mehta (OpenERP)" Date: Thu, 11 Oct 2012 15:11:32 +0530 Subject: [PATCH 03/11] [IMP]replace callbackenable from dateset on_change event. bzr revid: vme@tinyerp.com-20121011094132-9a752zxib2rpy4ji --- addons/web/static/src/js/data.js | 8 +++----- addons/web/static/src/js/view_form.js | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index ce85e0ac43f..bfe4506c679 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -834,7 +834,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ } $.extend(cached.values, record.values); if (dirty) - this.on_change(); + this.trigger("dataset_on_change"); return $.Deferred().resolve(true).promise(); }, unlink: function(ids, callback, error_callback) { @@ -848,7 +848,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ this.to_write = _.reject(this.to_write, function(x) { return _.include(ids, x.id);}); this.cache = _.reject(this.cache, function(x) { return _.include(ids, x.id);}); this.set_ids(_.without.apply(_, [this.ids].concat(ids))); - this.on_change(); + this.trigger("dataset_on_change"); return $.async_when({result: true}).then(callback); }, reset_ids: function(ids) { @@ -859,8 +859,6 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ this.cache = []; this.delete_all = false; }, - on_change: function() { - }, read_ids: function (ids, fields, options) { var self = this; var to_get = []; @@ -947,7 +945,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ }, alter_ids: function(n_ids) { this._super(n_ids); - this.on_change(); + this.trigger("dataset_on_change"); }, }); instance.web.BufferedDataSet.virtual_id_regex = /^one2many_v_id_.*$/; diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index afb5e258c0b..ab4b67353aa 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3284,7 +3284,7 @@ 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.on_change.add_last(function() { + this.dataset.on('dataset_on_change', this, function() { self.trigger_on_change(); }); @@ -3581,7 +3581,7 @@ instance.web.form.One2ManyViewManager = instance.web.ViewManager.extend({ create_function: function(data) { return self.o2m.dataset.create(data).then(function(r) { self.o2m.dataset.set_ids(self.o2m.dataset.ids.concat([r])); - self.o2m.dataset.on_change(); + self.o2m.dataset.trigger("dataset_on_change"); }); }, write_function: function(id, data, options) { @@ -3671,7 +3671,7 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({ create_function: function(data, callback, error_callback) { return self.o2m.dataset.create(data).then(function(r) { self.o2m.dataset.set_ids(self.o2m.dataset.ids.concat([r])); - self.o2m.dataset.on_change(); + self.o2m.dataset.trigger("dataset_on_change"); }).then(callback, error_callback); }, read_function: function() { From 4112f2b3a76f2ad924fa35a2ddfc9c654d7ac8cd Mon Sep 17 00:00:00 2001 From: "Vidhin Mehta (OpenERP)" Date: Fri, 12 Oct 2012 17:49:11 +0530 Subject: [PATCH 04/11] [IMP]method name change bzr revid: vme@tinyerp.com-20121012121911-nmzuomg2p87qiszp --- addons/web/static/src/js/data.js | 6 +++--- addons/web/static/src/js/view_form.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index bfe4506c679..1731f1effaa 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -834,7 +834,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ } $.extend(cached.values, record.values); if (dirty) - this.trigger("dataset_on_change"); + this.trigger("dataset_changed", id); return $.Deferred().resolve(true).promise(); }, unlink: function(ids, callback, error_callback) { @@ -848,7 +848,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ this.to_write = _.reject(this.to_write, function(x) { return _.include(ids, x.id);}); this.cache = _.reject(this.cache, function(x) { return _.include(ids, x.id);}); this.set_ids(_.without.apply(_, [this.ids].concat(ids))); - this.trigger("dataset_on_change"); + this.trigger("dataset_changed", ids); return $.async_when({result: true}).then(callback); }, reset_ids: function(ids) { @@ -945,7 +945,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ }, alter_ids: function(n_ids) { this._super(n_ids); - this.trigger("dataset_on_change"); + this.trigger("dataset_changed", n_ids); }, }); instance.web.BufferedDataSet.virtual_id_regex = /^one2many_v_id_.*$/; diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 7fa4860a67c..c3a94838cf6 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3287,7 +3287,7 @@ 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.on('dataset_on_change', this, function() { + this.dataset.on('dataset_changed', this, function() { self.trigger_on_change(); }); @@ -3582,7 +3582,7 @@ instance.web.form.One2ManyViewManager = instance.web.ViewManager.extend({ create_function: function(data) { return self.o2m.dataset.create(data).then(function(r) { self.o2m.dataset.set_ids(self.o2m.dataset.ids.concat([r])); - self.o2m.dataset.trigger("dataset_on_change"); + self.o2m.dataset.trigger("dataset_changed", r); }); }, write_function: function(id, data, options) { @@ -3672,7 +3672,7 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({ create_function: function(data, callback, error_callback) { return self.o2m.dataset.create(data).then(function(r) { self.o2m.dataset.set_ids(self.o2m.dataset.ids.concat([r])); - self.o2m.dataset.trigger("dataset_on_change"); + self.o2m.dataset.trigger("dataset_changed", r); }).then(callback, error_callback); }, read_function: function() { From e273ccce6394f0cc092aff81f9e33310b9bc6310 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sun, 14 Oct 2012 21:55:14 +0200 Subject: [PATCH 05/11] [FIX] fix of r3147 bzr revid: fp@openerp.com-20121014195514-xnw8b23qtnjm1it2 --- addons/web/static/src/css/base.css | 31 +++++++++++++++-------------- addons/web/static/src/css/base.sass | 12 ++++++----- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index c8f1567bee9..8925c3a0964 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -25,6 +25,7 @@ display: none !important; } } + .openerp.openerp_webclient_container { height: 100%; position: relative; @@ -1184,7 +1185,7 @@ color: white; padding: 2px 4px; margin: 1px 6px 0 0; - border: 1px solid lightgrey; + border: 1px solid lightGray; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); -moz-border-radius: 4px; -webkit-border-radius: 4px; @@ -1209,7 +1210,7 @@ transform: scale(1.1); } .openerp .oe_secondary_submenu .oe_active { - border-top: 1px solid lightgrey; + border-top: 1px solid lightGray; border-bottom: 1px solid #dedede; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); -moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), inset 0 -1px 3px rgba(40, 40, 40, 0.2); @@ -2054,36 +2055,36 @@ width: 400px; padding-bottom: 0; } -.openerp .oe_form header .oe_tags div.oe_chatter { +.openerp .oe_form div.oe_chatter { min-width: 650px; max-width: 860px; margin: 0 auto; padding: 16px 0 48px; } -.openerp .oe_form header .oe_tags div.oe_form_configuration p, .openerp .oe_form header .oe_tags div.oe_form_configuration ul, .openerp .oe_form header .oe_tags div.oe_form_configuration ol { +.openerp .oe_form div.oe_form_configuration p, .openerp .oe_form div.oe_form_configuration ul, .openerp .oe_form div.oe_form_configuration ol { color: #aaaaaa; max-width: 650px; } -.openerp .oe_form header .oe_tags div.oe_form_configuration label { +.openerp .oe_form div.oe_form_configuration label { min-width: 150px; } -.openerp .oe_form header .oe_tags div.oe_form_configuration .oe_form_group_cell_label { +.openerp .oe_form div.oe_form_configuration .oe_form_group_cell_label { padding: 1px 0; } -.openerp .oe_form header .oe_tags div.oe_form_configuration .oe_form_group_cell div div { +.openerp .oe_form div.oe_form_configuration .oe_form_group_cell div div { padding: 1px 0; } -.openerp .oe_form header .oe_tags .oe_subtotal_footer { +.openerp .oe_form .oe_subtotal_footer { width: 1% !important; } -.openerp .oe_form header .oe_tags .oe_subtotal_footer td.oe_form_group_cell { +.openerp .oe_form .oe_subtotal_footer td.oe_form_group_cell { text-align: right; padding: 0 !important; } -.openerp .oe_form header .oe_tags .oe_subtotal_footer td.oe_form_group_cell_label { +.openerp .oe_form .oe_subtotal_footer td.oe_form_group_cell_label { border-right: none; } -.openerp .oe_form header .oe_tags .oe_subtotal_footer .oe_subtotal_footer_separator { +.openerp .oe_form .oe_subtotal_footer .oe_subtotal_footer_separator { width: 108px; border-top: 1px solid #cacaca; margin-top: 4px; @@ -2091,14 +2092,14 @@ font-weight: bold; font-size: 18px; } -.openerp .oe_form header .oe_tags .oe_subtotal_footer label:after { +.openerp .oe_form .oe_subtotal_footer label:after { content: ":"; } -.openerp .oe_form header .oe_tags .oe_subtotal_footer label.oe_subtotal_footer_separator { +.openerp .oe_form .oe_subtotal_footer label.oe_subtotal_footer_separator { font-weight: bold !important; padding: 2px 11px 2px 0px !important; } -.openerp .oe_form header .oe_tags .oe_subtotal_footer label.oe_form_label_help { +.openerp .oe_form .oe_subtotal_footer label.oe_form_label_help { font-weight: normal; } .openerp .oe_form .oe_form_button { @@ -2130,7 +2131,7 @@ } .openerp .oe_form .oe_form_label_help[for] span, .openerp .oe_form .oe_form_label[for] span { font-size: 80%; - color: darkgreen; + color: darkGreen; vertical-align: top; position: relative; top: -4px; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 823ced4e24f..a1adfe67e75 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1616,16 +1616,18 @@ $sheet-max-width: 860px ul display: inline-block float: right - .oe_button, + .oe_button margin: 3px 2px 1px &:first-child margin-left: 6px // }}} // FormView.custom tags and classes {{{ - .oe_form header .oe_tags - margin: 5px 0 0 5px - width: 400px - padding-bottom: 0 + .oe_form + header + .oe_tags + margin: 5px 0 0 5px + width: 400px + padding-bottom: 0 div.oe_chatter min-width: 650px max-width: $sheet-max-width From 76fe8893311de8e12b62d74a0e6df134bae9068c Mon Sep 17 00:00:00 2001 From: "vta vta@openerp.com" <> Date: Mon, 15 Oct 2012 09:53:20 +0200 Subject: [PATCH 06/11] [FIX] Fixed some small issues concerning event triggering. bzr revid: vta@openerp.com-20121015075320-2zgo32vy5fengm7b --- addons/web/static/src/js/data.js | 10 +++++----- addons/web/static/src/js/view_form.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 48210007dcd..fe7632d0612 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -568,7 +568,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({ */ write: function (id, data, options) { options = options || {}; - return this._model.call('write', [[id], data], {context: this._model.context(options.context)}); + return this._model.call('write', [[id], data], {context: this._model.context(options.context)}).then(this.trigger('dataset_changed', id, data, options)); }, /** * Deletes an existing record from the database @@ -576,8 +576,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({ * @param {Number|String} ids identifier of the record to delete */ unlink: function(ids) { - this.trigger('unlink', ids); - return this._model.call('unlink', [ids], {context: this._model.context()}); + return this._model.call('unlink', [ids], {context: this._model.context()}).then(this.trigger('dataset_changed', ids)); }, /** * Calls an arbitrary RPC method @@ -779,6 +778,7 @@ instance.web.DataSetSearch = instance.web.DataSet.extend({ self.index = self.index <= self.ids.length - 1 ? self.index : (self.ids.length > 0 ? self.ids.length -1 : 0); } + this.trigger("dataset_changed", ids, callback, error_callback); }); }, size: function () { @@ -835,7 +835,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ } $.extend(cached.values, record.values); if (dirty) - this.trigger("dataset_changed", id); + this.trigger("dataset_changed", id, data, options); return $.Deferred().resolve(true).promise(); }, unlink: function(ids, callback, error_callback) { @@ -849,7 +849,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ this.to_write = _.reject(this.to_write, function(x) { return _.include(ids, x.id);}); this.cache = _.reject(this.cache, function(x) { return _.include(ids, x.id);}); this.set_ids(_.without.apply(_, [this.ids].concat(ids))); - this.trigger("dataset_changed", ids); + this.trigger("dataset_changed", ids, callback, error_callback); return $.async_when({result: true}).then(callback); }, reset_ids: function(ids) { diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 67a36661b12..60c33090c56 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -749,7 +749,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM on_button_save: function() { var self = this; return this.save().then(function(result) { - self.trigger("save"); + self.trigger("save", result); self.to_view_mode(); }); }, From e06e3aad4a98450300018ceecf502b789224301a Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Mon, 15 Oct 2012 14:09:34 +0200 Subject: [PATCH 07/11] [IMP] tools.html2plaintext: consistent use of lxml.etree.HTMLParser to convert HTML to plaintext We used to switch to using BeautifulSoup when available, but that lead to inconsistent behavior depending on the installed Python packages, and sometimes lead to bad surprises. There is no advantage in using BeautifulSoup rather than HTMLParser, and the latter is always available. bzr revid: odo@openerp.com-20121015120934-njaylf99dc5zekfw --- openerp/tools/misc.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/openerp/tools/misc.py b/openerp/tools/misc.py index 130db6f0d4e..c9283a839d4 100644 --- a/openerp/tools/misc.py +++ b/openerp/tools/misc.py @@ -312,16 +312,8 @@ def html2plaintext(html, body_id=None, encoding='utf-8'): html = ustr(html) - from lxml.etree import tostring - try: - from lxml.html.soupparser import fromstring - kwargs = {} - except ImportError: - _logger.debug('tools.misc.html2plaintext: cannot use BeautifulSoup, fallback to lxml.etree.HTMLParser') - from lxml.etree import fromstring, HTMLParser - kwargs = dict(parser=HTMLParser()) - - tree = fromstring(html, **kwargs) + from lxml.etree import tostring, fromstring, HTMLParser + tree = fromstring(html, parser=HTMLParser()) if body_id is not None: source = tree.xpath('//*[@id=%s]'%(body_id,)) From 38582c8410f77ef4b105f634fd543f630dd43613 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 15 Oct 2012 14:38:56 +0200 Subject: [PATCH 08/11] [FIX] Problem in editable list view: in sale orders, when we add a line in the order lines o2m then select a product, some strange numbers appear on the top left of the list view. bzr revid: nicolas.vanhoren@openerp.com-20121015123856-j4sgaqtf3oexg6of --- .../web/static/src/js/view_list_editable.js | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index 4bf61895a09..cd6b018ea0d 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -201,10 +201,7 @@ openerp.web.list_editable = function (instance) { }, function () { return self.editor.edit(item, function (field_name, field) { var cell = cells[field_name]; - if (!cell || field.get('effective_readonly')) { - // Readonly fields can just remain the list's, - // form's usually don't have backgrounds &al - field.set({invisible: true}); + if (!cell) { return; } @@ -400,6 +397,21 @@ openerp.web.list_editable = function (instance) { }, setup_events: function () { var self = this; + _.each(this.editor.form.fields, function(field, field_name) { + var field; + var setting = false; + var set_invisible = function() { + if (!setting && field.get("effective_readonly")) { + setting = true; + field.set({invisible: true}); + setting = false; + } + }; + field.on("change:effective_readonly", self, set_invisible); + field.on("change:invisible", self, set_invisible); + set_invisible(); + }); + this.editor.$el.on('keyup keydown', function (e) { if (!self.editor.is_editing()) { return; } var key = _($.ui.keyCode).chain() From 87ea306997c8b23b59cc5e35f71ec8e8d78e57a2 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 15 Oct 2012 14:51:23 +0200 Subject: [PATCH 09/11] [IMP] Modified formatting of m2o to be consistent with the m2o in form view bzr revid: nicolas.vanhoren@openerp.com-20121015125123-cyosgswtdxgtcom7 --- 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 3e5e6fecd5e..dd1fd95c97e 100644 --- a/addons/web/static/src/js/formats.js +++ b/addons/web/static/src/js/formats.js @@ -135,7 +135,7 @@ instance.web.format_value = function (value, descriptor, value_if_empty) { Math.round((value % 1) * 60)); case 'many2one': // name_get value format - return value[1]; + return value[1].split("\n")[0]; case 'one2many': case 'many2many': if (typeof value === 'string') { From 3db503e42373e734e63f021d574c9e2ce4e30375 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 15 Oct 2012 15:24:44 +0200 Subject: [PATCH 10/11] [IMP] Now form view relation popups use $buttons. bzr revid: nicolas.vanhoren@openerp.com-20121015132444-v3379ccn5xau8220 --- addons/web/static/src/js/view_form.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 60c33090c56..a3c6a4d7722 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -4404,9 +4404,8 @@ instance.web.form.AbstractFormPopup = instance.web.Widget.extend({ self.check_exit(true); }, title: this.options.title || "", - buttons: [{text:"tmp"}], }, this.$el).open(); - this.$buttonpane = dialog.$el.dialog("widget").find(".ui-dialog-buttonpane").html(""); + this.$buttonpane = dialog.$buttons; this.start(); }, setup_form_view: function() { From 0227125c44a119fbeca19b8e5b0b194fd9f0ed6d Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 15 Oct 2012 15:28:36 +0200 Subject: [PATCH 11/11] [IMP] Changed calendar to open popups with the buttons on the bottom left. bzr revid: nicolas.vanhoren@openerp.com-20121015132836-rg0y8kjdj7f3vh5h --- addons/web_calendar/static/src/js/calendar.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web_calendar/static/src/js/calendar.js b/addons/web_calendar/static/src/js/calendar.js index d08912bbaab..e4ecfdab53f 100644 --- a/addons/web_calendar/static/src/js/calendar.js +++ b/addons/web_calendar/static/src/js/calendar.js @@ -455,7 +455,8 @@ instance.web_calendar.CalendarFormDialog = instance.web.Dialog.extend({ var self = this; this._super(); this.form = new instance.web.FormView(this, this.dataset, this.view_id, { - pager: false + pager: false, + $buttons: this.$buttons, }); var def = this.form.appendTo(this.$el); this.form.on('record_created', self, this.on_form_dialog_saved);