[fix] fixed problem with o2m when we re-open a previously created row
bzr revid: nicolas.vanhoren@openerp.com-20110829121330-ulj3hnyo3jfs9fq4
This commit is contained in:
parent
863fdc0808
commit
3d3783d740
|
@ -1863,7 +1863,10 @@ openerp.base.form.One2ManyListView = openerp.base.ListView.extend({
|
||||||
pop.show_element(self.o2m.field.relation, id, self.o2m.build_context(),{
|
pop.show_element(self.o2m.field.relation, id, self.o2m.build_context(),{
|
||||||
auto_write: false,
|
auto_write: false,
|
||||||
alternative_form_view: self.o2m.field.views ? self.o2m.field.views["form"] : undefined,
|
alternative_form_view: self.o2m.field.views ? self.o2m.field.views["form"] : undefined,
|
||||||
parent_view: self.o2m.view
|
parent_view: self.o2m.view,
|
||||||
|
read_function: function() {
|
||||||
|
return self.o2m.dataset.read_ids.apply(self.o2m.dataset, arguments);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
pop.on_write.add(function(id, data) {
|
pop.on_write.add(function(id, data) {
|
||||||
self.o2m.dataset.write(id, data, function(r) {
|
self.o2m.dataset.write(id, data, function(r) {
|
||||||
|
@ -2135,6 +2138,7 @@ openerp.base.form.FormOpenPopup = openerp.base.OldWidget.extend({
|
||||||
* options:
|
* options:
|
||||||
* - alternative_form_view
|
* - alternative_form_view
|
||||||
* - auto_write (default true)
|
* - auto_write (default true)
|
||||||
|
* - read_function
|
||||||
* - parent_view
|
* - parent_view
|
||||||
*/
|
*/
|
||||||
show_element: function(model, row_id, context, options) {
|
show_element: function(model, row_id, context, options) {
|
||||||
|
@ -2150,7 +2154,8 @@ openerp.base.form.FormOpenPopup = openerp.base.OldWidget.extend({
|
||||||
},
|
},
|
||||||
start: function() {
|
start: function() {
|
||||||
this._super();
|
this._super();
|
||||||
this.dataset = new openerp.base.ReadOnlyDataSetSearch(this, this.model, this.context);
|
this.dataset = new openerp.base.form.FormOpenDataset(this, this.model, this.context);
|
||||||
|
this.dataset.fop = this;
|
||||||
this.dataset.ids = [this.row_id];
|
this.dataset.ids = [this.row_id];
|
||||||
this.dataset.index = 0;
|
this.dataset.index = 0;
|
||||||
this.dataset.parent_view = this.options.parent_view;
|
this.dataset.parent_view = this.options.parent_view;
|
||||||
|
@ -2192,6 +2197,16 @@ openerp.base.form.FormOpenPopup = openerp.base.OldWidget.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
openerp.base.form.FormOpenDataset = openerp.base.ReadOnlyDataSetSearch.extend({
|
||||||
|
read_ids: function() {
|
||||||
|
if (this.fop.options.read_function) {
|
||||||
|
return this.fop.options.read_function.apply(null, arguments);
|
||||||
|
} else {
|
||||||
|
this._super.apply(this, arguments);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
openerp.base.form.FieldReference = openerp.base.form.Field.extend({
|
openerp.base.form.FieldReference = openerp.base.form.Field.extend({
|
||||||
init: function(view, node) {
|
init: function(view, node) {
|
||||||
this._super(view, node);
|
this._super(view, node);
|
||||||
|
|
Loading…
Reference in New Issue