Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] fix #321, choked on cached writes #327

Merged
merged 1 commit into from
Mar 31, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,35 @@ openerp.web_widget_x2many_2d_matrix = function(instance)
self.is_numeric = fields[self.field_value].type == 'float';
self.show_row_totals &= self.is_numeric;
self.show_column_totals &= self.is_numeric;
}).then(function()
})
// if there are cached writes on the parent dataset, read below
// only returns the written data, which is not enough to properly
// set up our data structure. Read those ids here and patch the
// cache
.then(function()
{
var ids_written = _.map(
self.dataset.to_write, function(x) { return x.id });
if(!ids_written.length)
{
return;
}
return (new instance.web.Query(self.dataset._model))
.filter([['id', 'in', ids_written]])
.all()
.then(function(rows)
{
_.each(rows, function(row)
{
var cache = _.find(
self.dataset.cache,
function(x) { return x.id == row.id }
);
_.extend(cache.values, row, _.clone(cache.values));
})
})
})
.then(function()
{
return self.dataset.read_ids(self.dataset.ids).then(function(rows)
{
Expand Down