~petrus-v/openerp-web/7.0-bug-1314306

« back to all changes in this revision

Viewing changes to addons/web/static/src/js/view_list.js

  • Committer: Denis Ledoux
  • Date: 2014-03-26 11:30:36 UTC
  • Revision ID: dle@openerp.com-20140326113036-g9yv3jj6yetwxvg8
[FIX] web: on record reload (form & list view), use search_read instead of read, to check if the user can still read the record (security rules)

Show diffs side-by-side

added added

removed removed

Lines of Context:
528
528
    },
529
529
    reload_record: function (record) {
530
530
        var self = this;
531
 
        return this.dataset.read_ids(
532
 
            [record.get('id')],
 
531
        // Use of search_read instead of read to check if we can still read the record (security rules)
 
532
        return this.dataset.call('search_read', [
 
533
            [['id', '=', record.get('id')]],
533
534
            _.pluck(_(this.columns).filter(function (r) {
534
535
                    return r.tag === 'field';
535
 
                }), 'name')
 
536
                }), 'name')]
536
537
        ).done(function (records) {
537
 
            var values = records[0];
 
538
            var values = _.isEmpty(records) ? undefined : records[0];
538
539
            if (!values) {
539
540
                self.records.remove(record);
540
541
                return;