diff options
| author | Géry Debongnie <ged@odoo.com> | 2014-09-04 10:12:52 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2014-10-21 09:33:49 +0200 |
| commit | ffb8bf31af57cf845796acc90fa0f8b8b7d14de3 (patch) | |
| tree | 8f95610cd188ebd33dc9883756eccadb51330cf5 /addons/web/static/src/js | |
| parent | 582ccb5ab9061bcc3cd4d1511ca6c5c1d20a6adc (diff) | |
[FIX] fixes many issues with the various views
the views don't always return a proper promise, or were
somewhat fragile and broke with the changes in the view
manager.
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/view_form.js | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index ce5fab9a8a2..0dc0aedb737 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -4143,14 +4143,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ /** * Returns the current active view if any. */ - if (this.viewmanager && this.viewmanager.views && this.viewmanager.active_view && - this.viewmanager.views[this.viewmanager.active_view] && - this.viewmanager.views[this.viewmanager.active_view].controller) { - return { - type: this.viewmanager.active_view, - controller: this.viewmanager.views[this.viewmanager.active_view].controller - }; - } + return (this.viewmanager && this.viewmanager.active_view); }, set_value: function(value_) { value_ = value_ || []; @@ -4242,12 +4235,12 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ save_any_view: function() { var view = this.get_active_view(); if (view) { - if (this.viewmanager.active_view === "form") { + if (this.viewmanager.active_view.type === "form") { if (view.controller.is_initialized.state() !== 'resolved') { return $.when(false); } return $.when(view.controller.save()); - } else if (this.viewmanager.active_view === "list") { + } else if (this.viewmanager.active_view.type === "list") { return $.when(view.controller.ensure_saved()); } } @@ -4258,7 +4251,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ if (!view){ return true; } - switch (this.viewmanager.active_view) { + switch (this.viewmanager.active_view.type) { case 'form': return _(view.controller.fields).chain() .invoke('is_valid') @@ -4275,7 +4268,7 @@ instance.web.form.One2ManyViewManager = instance.web.ViewManager.extend({ template: 'One2Many.viewmanager', init: function(parent, dataset, views, flags) { this._super(parent, dataset, views, _.extend({}, flags, {$sidebar: false})); - this.registry = this.registry.extend({ + this.registry = instance.web.views.extend({ list: 'instance.web.form.One2ManyListView', form: 'instance.web.form.One2ManyFormView', kanban: 'instance.web.form.One2ManyKanbanView', |
