});
this.views = views;
- this.viewmanager = new instance.web.ViewManager(this, this.dataset, views, {
- $sidebar: false,
- });
- this.viewmanager.template = 'One2Many.viewmanager';
- this.viewmanager.registry = instance.web.views.extend({
- list: 'instance.web.form.One2ManyListView',
- form: 'instance.web.form.One2ManyFormView',
- kanban: 'instance.web.form.One2ManyKanbanView',
- });
+ this.viewmanager = new instance.web.form.One2ManyViewManager(this, this.dataset, views, {});
+ this.viewmanager.o2m = self;
var once = $.Deferred().then(function() {
self.init_form_last_update.resolve();
});
},
});
+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({
+ list: 'instance.web.form.One2ManyListView',
+ form: 'instance.web.form.One2ManyFormView',
+ kanban: 'instance.web.form.One2ManyKanbanView',
+ });
+ },
+ switch_view: function(mode, unused) {
+ return this._super(mode, unused);
+ },
+});
+
instance.web.form.One2ManyDataSet = instance.web.BufferedDataSet.extend({
get_context: function() {
this.context = this.o2m.build_context([this.o2m.name]);
if (view.embedded_view) {
controller.set_embedded_view(view.embedded_view);
}
- controller.do_switch_view.add_last(this.on_mode_switch);
+ controller.do_switch_view.add_last(_.bind(this.switch_view, this));
controller.do_prev_view.add_last(this.on_prev_view);
var container = this.$element.find(".oe_view_manager_view_" + view_type);
view_promise = controller.appendTo(container);
});
return view_promise;
},
+ switch_view: function(view_type, no_store) {
+ return this.on_mode_switch(view_type, no_store);
+ },
/**
* Returns to the view preceding the caller view in this manager's
* navigation history (the navigation history is appended to via