Store readonly attribute on Screen with a default value
Otherwise the attribute value may be undefined instead of being a boolean. Closes #13324 (grafted from c0feae75063f1daac6b3c8017f165aaca3858922) --HG-- branch : 6.0
This commit is contained in:
+9
-5
@@ -801,9 +801,7 @@
|
||||
this.views = [];
|
||||
this.views_preload = attributes.views_preload || {};
|
||||
this.exclude_field = attributes.exclude_field;
|
||||
this.new_group(attributes.context || {});
|
||||
this.current_view = null;
|
||||
this.current_record = null;
|
||||
this.domain = attributes.domain || [];
|
||||
this.context_domain = attributes.context_domain;
|
||||
this.size_limit = null;
|
||||
@@ -814,11 +812,14 @@
|
||||
}
|
||||
this.offset = 0;
|
||||
this.order = this.default_order = attributes.order;
|
||||
this.readonly = this.attributes.readonly || false;
|
||||
var access = Sao.common.MODELACCESS.get(model_name);
|
||||
if (!(access.write || access.create)) {
|
||||
this.attributes.readonly = true;
|
||||
this.readonly = true;
|
||||
}
|
||||
this.search_count = 0;
|
||||
this.new_group(attributes.context || {});
|
||||
this.current_record = null;
|
||||
this.screen_container = new Sao.ScreenContainer(
|
||||
attributes.tab_domain);
|
||||
this.breadcrumb = attributes.breadcrumb || [];
|
||||
@@ -868,7 +869,10 @@
|
||||
var readonly_records = this.selected_records.some(function(r) {
|
||||
return r.readonly;
|
||||
});
|
||||
return this.attributes.readonly || readonly_records;
|
||||
return this.__readonly || readonly_records;
|
||||
},
|
||||
set readonly(value) {
|
||||
this.__readonly = value;
|
||||
},
|
||||
get deletable() {
|
||||
return this.selected_records.every(function(r) {
|
||||
@@ -1251,7 +1255,7 @@
|
||||
context = this.context;
|
||||
}
|
||||
var group = new Sao.Group(this.model, context, []);
|
||||
group.readonly = this.attributes.readonly;
|
||||
group.readonly = this.__readonly;
|
||||
this.set_group(group);
|
||||
},
|
||||
get current_record() {
|
||||
|
||||
Reference in New Issue
Block a user