tryton-sao 7.2.2 → 7.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG +10 -0
- package/dist/tryton-sao.css +8 -4
- package/dist/tryton-sao.js +98 -42
- package/package.json +1 -1
- package/src/model.js +6 -3
- package/src/sao.js +30 -1
- package/src/sao.less +10 -6
- package/src/screen.js +9 -5
- package/src/tab.js +4 -2
- package/src/view/calendar.js +18 -9
- package/src/view/tree.js +11 -12
- package/src/window.js +18 -9
- package/src/wizard.js +2 -1
package/CHANGELOG
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
|
|
2
|
+
Version 7.2.4 - 2024-07-17
|
|
3
|
+
--------------------------
|
|
4
|
+
* Bug fixes (see mercurial logs for details)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Version 7.2.3 - 2024-07-01
|
|
8
|
+
--------------------------
|
|
9
|
+
* Bug fixes (see mercurial logs for details)
|
|
10
|
+
|
|
11
|
+
|
|
2
12
|
Version 7.2.2 - 2024-06-15
|
|
3
13
|
--------------------------
|
|
4
14
|
* Bug fixes (see mercurial logs for details)
|
package/dist/tryton-sao.css
CHANGED
|
@@ -10066,10 +10066,14 @@ img.icon {
|
|
|
10066
10066
|
min-height: 150px;
|
|
10067
10067
|
max-height: 300px;
|
|
10068
10068
|
}
|
|
10069
|
-
.form .form-text
|
|
10070
|
-
.form .form-richtext
|
|
10071
|
-
|
|
10072
|
-
|
|
10069
|
+
.form .form-text .input-group,
|
|
10070
|
+
.form .form-richtext .input-group {
|
|
10071
|
+
width: 100%;
|
|
10072
|
+
}
|
|
10073
|
+
.form .form-text .input-group textarea,
|
|
10074
|
+
.form .form-richtext .input-group textarea,
|
|
10075
|
+
.form .form-text .input-group .richtext,
|
|
10076
|
+
.form .form-richtext .input-group .richtext {
|
|
10073
10077
|
height: 100%;
|
|
10074
10078
|
line-height: 2.5ex;
|
|
10075
10079
|
min-height: 12.5ex;
|
package/dist/tryton-sao.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
/* eslint-disable no-redeclare */
|
|
5
5
|
var Sao = {
|
|
6
|
-
__version__: '7.2.
|
|
6
|
+
__version__: '7.2.4',
|
|
7
7
|
};
|
|
8
8
|
/* eslint-enable no-redeclare */
|
|
9
9
|
|
|
@@ -107,6 +107,35 @@ var Sao = {
|
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
if (!Set.prototype.intersection) {
|
|
111
|
+
Set.prototype.intersection = function(other) {
|
|
112
|
+
if (this === null) {
|
|
113
|
+
throw new TypeError();
|
|
114
|
+
}
|
|
115
|
+
const result = new Set();
|
|
116
|
+
for (const key of other.keys()) {
|
|
117
|
+
if (this.has(key)) {
|
|
118
|
+
result.add(key)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (!Set.prototype.isSubsetOf) {
|
|
126
|
+
Set.prototype.isSubsetOf = function(other) {
|
|
127
|
+
if (this === null) {
|
|
128
|
+
throw new TypeError();
|
|
129
|
+
}
|
|
130
|
+
for (const key of this.keys()) {
|
|
131
|
+
if (!other.has(key)) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
110
139
|
Sao.setdefault = function(object, key, value) {
|
|
111
140
|
if (!Object.prototype.hasOwnProperty.call(object, key)) {
|
|
112
141
|
object[key] = value;
|
|
@@ -8290,6 +8319,7 @@ var Sao = {
|
|
|
8290
8319
|
views = this.model.fields[name].views;
|
|
8291
8320
|
}
|
|
8292
8321
|
var fields = {};
|
|
8322
|
+
var views_operator;
|
|
8293
8323
|
if (loading == 'eager') {
|
|
8294
8324
|
for (fname in this.model.fields) {
|
|
8295
8325
|
field = this.model.fields[fname];
|
|
@@ -8297,17 +8327,19 @@ var Sao = {
|
|
|
8297
8327
|
fields[fname] = field;
|
|
8298
8328
|
}
|
|
8299
8329
|
}
|
|
8330
|
+
views_operator = views.isSubsetOf.bind(views);
|
|
8300
8331
|
} else {
|
|
8301
8332
|
fields = this.model.fields;
|
|
8333
|
+
views_operator = function(view) {
|
|
8334
|
+
return Boolean(this.intersection(view).size);
|
|
8335
|
+
}.bind(views);
|
|
8302
8336
|
}
|
|
8303
8337
|
var fnames = [];
|
|
8304
8338
|
for (fname in fields) {
|
|
8305
8339
|
field = fields[fname];
|
|
8306
8340
|
if (!(fname in this._loaded) &&
|
|
8307
8341
|
(!views.size ||
|
|
8308
|
-
|
|
8309
|
-
Array.from(views).sort(),
|
|
8310
|
-
Array.from(field.views).sort()))) {
|
|
8342
|
+
views_operator(new Set(field.views)))) {
|
|
8311
8343
|
fnames.push(fname);
|
|
8312
8344
|
}
|
|
8313
8345
|
}
|
|
@@ -10765,7 +10797,9 @@ var Sao = {
|
|
|
10765
10797
|
this.menu_buttons[item.id] = menuitem;
|
|
10766
10798
|
link.click(evt => {
|
|
10767
10799
|
evt.preventDefault();
|
|
10768
|
-
|
|
10800
|
+
if (!menuitem.hasClass('disabled')) {
|
|
10801
|
+
this[item.id]();
|
|
10802
|
+
}
|
|
10769
10803
|
});
|
|
10770
10804
|
} else if (!item && previous) {
|
|
10771
10805
|
menuitem = jQuery('<li/>', {
|
|
@@ -11861,7 +11895,7 @@ var Sao = {
|
|
|
11861
11895
|
this.refresh_resources(true);
|
|
11862
11896
|
});
|
|
11863
11897
|
for (const file of files) {
|
|
11864
|
-
Sao.common.get_file_data(file, window_.add_data);
|
|
11898
|
+
Sao.common.get_file_data(file, window_.add_data.bind(window_));
|
|
11865
11899
|
}
|
|
11866
11900
|
jQuery.when.apply(jQuery, uris).then(function() {
|
|
11867
11901
|
function empty(value) {
|
|
@@ -13115,9 +13149,7 @@ var Sao = {
|
|
|
13115
13149
|
this.views = [];
|
|
13116
13150
|
this.views_preload = attributes.views_preload || {};
|
|
13117
13151
|
this.exclude_field = attributes.exclude_field;
|
|
13118
|
-
this.new_group(attributes.context || {});
|
|
13119
13152
|
this.current_view = null;
|
|
13120
|
-
this.current_record = null;
|
|
13121
13153
|
this.domain = attributes.domain || [];
|
|
13122
13154
|
this.context_domain = attributes.context_domain;
|
|
13123
13155
|
this.size_limit = null;
|
|
@@ -13129,11 +13161,14 @@ var Sao = {
|
|
|
13129
13161
|
this._current_domain = [];
|
|
13130
13162
|
this.offset = 0;
|
|
13131
13163
|
this.order = this.default_order = attributes.order;
|
|
13164
|
+
this.readonly = this.attributes.readonly || false;
|
|
13132
13165
|
var access = Sao.common.MODELACCESS.get(model_name);
|
|
13133
13166
|
if (!(access.write || access.create)) {
|
|
13134
|
-
this.
|
|
13167
|
+
this.readonly = true;
|
|
13135
13168
|
}
|
|
13136
13169
|
this.search_count = 0;
|
|
13170
|
+
this.new_group(attributes.context || {});
|
|
13171
|
+
this.current_record = null;
|
|
13137
13172
|
this.screen_container = new Sao.ScreenContainer(
|
|
13138
13173
|
attributes.tab_domain);
|
|
13139
13174
|
this.breadcrumb = attributes.breadcrumb || [];
|
|
@@ -13176,7 +13211,10 @@ var Sao = {
|
|
|
13176
13211
|
var readonly_records = this.selected_records.some(function(r) {
|
|
13177
13212
|
return r.readonly;
|
|
13178
13213
|
});
|
|
13179
|
-
return this.
|
|
13214
|
+
return this.__readonly || readonly_records;
|
|
13215
|
+
},
|
|
13216
|
+
set readonly(value) {
|
|
13217
|
+
this.__readonly = value;
|
|
13180
13218
|
},
|
|
13181
13219
|
get deletable() {
|
|
13182
13220
|
return this.selected_records.every(function(r) {
|
|
@@ -13554,7 +13592,7 @@ var Sao = {
|
|
|
13554
13592
|
context = this.context;
|
|
13555
13593
|
}
|
|
13556
13594
|
var group = new Sao.Group(this.model, context, []);
|
|
13557
|
-
group.readonly = this.
|
|
13595
|
+
group.readonly = this.__readonly;
|
|
13558
13596
|
this.set_group(group);
|
|
13559
13597
|
},
|
|
13560
13598
|
record_modified: function(display=true) {
|
|
@@ -21183,7 +21221,7 @@ function eval_pyson(value){
|
|
|
21183
21221
|
},
|
|
21184
21222
|
display: function(selected, expanded) {
|
|
21185
21223
|
var current_record = this.record;
|
|
21186
|
-
if (jQuery.isEmptyObject(selected)) {
|
|
21224
|
+
if (jQuery.isEmptyObject(selected) && current_record) {
|
|
21187
21225
|
selected = this.get_selected_paths();
|
|
21188
21226
|
if (this.selection.prop('checked') &&
|
|
21189
21227
|
!this.selection.prop('indeterminate')) {
|
|
@@ -21192,16 +21230,12 @@ function eval_pyson(value){
|
|
|
21192
21230
|
selected.push([record.id]);
|
|
21193
21231
|
}
|
|
21194
21232
|
} else {
|
|
21195
|
-
|
|
21196
|
-
|
|
21197
|
-
|
|
21198
|
-
|
|
21199
|
-
|
|
21200
|
-
|
|
21201
|
-
selected = [current_path];
|
|
21202
|
-
}
|
|
21203
|
-
} else if (!current_record) {
|
|
21204
|
-
selected = [];
|
|
21233
|
+
var current_path = current_record.get_path(this.group);
|
|
21234
|
+
current_path = current_path.map(function(e) {
|
|
21235
|
+
return e[1];
|
|
21236
|
+
});
|
|
21237
|
+
if (!Sao.common.contains(selected, current_path)) {
|
|
21238
|
+
selected = [current_path];
|
|
21205
21239
|
}
|
|
21206
21240
|
}
|
|
21207
21241
|
}
|
|
@@ -21782,7 +21816,10 @@ function eval_pyson(value){
|
|
|
21782
21816
|
if (this.editable && new_) {
|
|
21783
21817
|
td.trigger('click');
|
|
21784
21818
|
}
|
|
21785
|
-
|
|
21819
|
+
var child = Sao.common.find_focusable_child(td);
|
|
21820
|
+
if (child) {
|
|
21821
|
+
child.focus();
|
|
21822
|
+
}
|
|
21786
21823
|
}
|
|
21787
21824
|
}
|
|
21788
21825
|
};
|
|
@@ -24400,17 +24437,26 @@ function eval_pyson(value){
|
|
|
24400
24437
|
if (!this.start && !this.end) {
|
|
24401
24438
|
return [['id', '=', -1]];
|
|
24402
24439
|
}
|
|
24403
|
-
var
|
|
24404
|
-
var
|
|
24440
|
+
var start = Sao.DateTime(this.start);
|
|
24441
|
+
var end = Sao.DateTime(this.end);
|
|
24405
24442
|
var dtstart = this.attributes.dtstart;
|
|
24406
24443
|
var dtend = this.attributes.dtend || dtstart;
|
|
24407
|
-
|
|
24408
|
-
|
|
24409
|
-
|
|
24410
|
-
|
|
24411
|
-
|
|
24412
|
-
|
|
24413
|
-
|
|
24444
|
+
var fields = this.screen.model.fields;
|
|
24445
|
+
if (fields[dtstart].description.type == 'date') {
|
|
24446
|
+
start = start.todate();
|
|
24447
|
+
}
|
|
24448
|
+
if (fields[dtend].description.type == 'date') {
|
|
24449
|
+
end = end.todate();
|
|
24450
|
+
}
|
|
24451
|
+
return [
|
|
24452
|
+
[dtstart, '!=', null],
|
|
24453
|
+
[dtend, '!=', null],
|
|
24454
|
+
['OR',
|
|
24455
|
+
['AND', [dtstart, '>=', start], [dtstart, '<', end]],
|
|
24456
|
+
['AND', [dtend, '>=', start], [dtend, '<', end]],
|
|
24457
|
+
['AND', [dtstart, '<', start], [dtend, '>', end]],
|
|
24458
|
+
],
|
|
24459
|
+
];
|
|
24414
24460
|
},
|
|
24415
24461
|
get_displayed_period: function(){
|
|
24416
24462
|
var DatesPeriod = [];
|
|
@@ -25045,7 +25091,7 @@ function eval_pyson(value){
|
|
|
25045
25091
|
}
|
|
25046
25092
|
});
|
|
25047
25093
|
|
|
25048
|
-
var readonly = this.screen.
|
|
25094
|
+
var readonly = this.screen.group.readonly;
|
|
25049
25095
|
|
|
25050
25096
|
this.but_ok = null;
|
|
25051
25097
|
this.but_new = null;
|
|
@@ -25272,7 +25318,7 @@ function eval_pyson(value){
|
|
|
25272
25318
|
var name = '_';
|
|
25273
25319
|
var access = Sao.common.MODELACCESS.get(this.screen.model_name);
|
|
25274
25320
|
var deletable = this.screen.deletable;
|
|
25275
|
-
var readonly = this.screen.
|
|
25321
|
+
var readonly = this.screen.group.readonly;
|
|
25276
25322
|
if (position >= 1) {
|
|
25277
25323
|
name = position;
|
|
25278
25324
|
if (this.domain) {
|
|
@@ -25280,10 +25326,12 @@ function eval_pyson(value){
|
|
|
25280
25326
|
}
|
|
25281
25327
|
this.but_next.prop('disabled', position >= size);
|
|
25282
25328
|
this.but_previous.prop('disabled', position <= 1);
|
|
25283
|
-
|
|
25284
|
-
|
|
25285
|
-
|
|
25286
|
-
|
|
25329
|
+
this.but_del.prop(
|
|
25330
|
+
'disabled',
|
|
25331
|
+
readonly ||
|
|
25332
|
+
!access.delete ||
|
|
25333
|
+
!deletable);
|
|
25334
|
+
this.but_undel.prop('disabled', readonly);
|
|
25287
25335
|
} else {
|
|
25288
25336
|
this.but_del.prop('disabled', true);
|
|
25289
25337
|
this.but_undel.prop('disabled', true);
|
|
@@ -25356,7 +25404,7 @@ function eval_pyson(value){
|
|
|
25356
25404
|
response: function(response_id) {
|
|
25357
25405
|
var result;
|
|
25358
25406
|
this.screen.current_view.set_value();
|
|
25359
|
-
var readonly = this.screen.
|
|
25407
|
+
var readonly = this.screen.group.readonly;
|
|
25360
25408
|
if (~['RESPONSE_OK', 'RESPONSE_ACCEPT'].indexOf(response_id) &&
|
|
25361
25409
|
!readonly &&
|
|
25362
25410
|
this.screen.current_record) {
|
|
@@ -25784,8 +25832,14 @@ function eval_pyson(value){
|
|
|
25784
25832
|
this.title = title;
|
|
25785
25833
|
this.exclude_field = kwargs.exclude_field || null;
|
|
25786
25834
|
var dialog = new Sao.Dialog(Sao.i18n.gettext(
|
|
25787
|
-
'Search %1', this.title), '', 'lg');
|
|
25835
|
+
'Search %1', this.title), '', 'lg', false);
|
|
25788
25836
|
this.el = dialog.modal;
|
|
25837
|
+
this.el.on('keydown', e => {
|
|
25838
|
+
if (e.which == Sao.common.ESC_KEYCODE) {
|
|
25839
|
+
e.preventDefault();
|
|
25840
|
+
this.response('RESPONSE_CANCEL');
|
|
25841
|
+
}
|
|
25842
|
+
});
|
|
25789
25843
|
|
|
25790
25844
|
jQuery('<button/>', {
|
|
25791
25845
|
'class': 'btn btn-link',
|
|
@@ -25861,7 +25915,8 @@ function eval_pyson(value){
|
|
|
25861
25915
|
if (response_id == 'RESPONSE_OK') {
|
|
25862
25916
|
records = this.screen.current_view.selected_records;
|
|
25863
25917
|
} else if (response_id == 'RESPONSE_APPLY') {
|
|
25864
|
-
this.screen.search_filter(
|
|
25918
|
+
this.screen.search_filter(
|
|
25919
|
+
this.screen.screen_container.get_text());
|
|
25865
25920
|
return;
|
|
25866
25921
|
} else if (response_id == 'RESPONSE_ACCEPT') {
|
|
25867
25922
|
var view_ids = jQuery.extend([], this.view_ids);
|
|
@@ -27932,7 +27987,8 @@ function eval_pyson(value){
|
|
|
27932
27987
|
}
|
|
27933
27988
|
if (!dialog ||
|
|
27934
27989
|
!this.model ||
|
|
27935
|
-
(Sao.main_menu_screen
|
|
27990
|
+
(Sao.main_menu_screen &&
|
|
27991
|
+
(Sao.main_menu_screen.model_name == this.model))) {
|
|
27936
27992
|
is_menu = true;
|
|
27937
27993
|
screen = Sao.main_menu_screen;
|
|
27938
27994
|
} else {
|
package/package.json
CHANGED
package/src/model.js
CHANGED
|
@@ -681,6 +681,7 @@
|
|
|
681
681
|
views = this.model.fields[name].views;
|
|
682
682
|
}
|
|
683
683
|
var fields = {};
|
|
684
|
+
var views_operator;
|
|
684
685
|
if (loading == 'eager') {
|
|
685
686
|
for (fname in this.model.fields) {
|
|
686
687
|
field = this.model.fields[fname];
|
|
@@ -688,17 +689,19 @@
|
|
|
688
689
|
fields[fname] = field;
|
|
689
690
|
}
|
|
690
691
|
}
|
|
692
|
+
views_operator = views.isSubsetOf.bind(views);
|
|
691
693
|
} else {
|
|
692
694
|
fields = this.model.fields;
|
|
695
|
+
views_operator = function(view) {
|
|
696
|
+
return Boolean(this.intersection(view).size);
|
|
697
|
+
}.bind(views);
|
|
693
698
|
}
|
|
694
699
|
var fnames = [];
|
|
695
700
|
for (fname in fields) {
|
|
696
701
|
field = fields[fname];
|
|
697
702
|
if (!(fname in this._loaded) &&
|
|
698
703
|
(!views.size ||
|
|
699
|
-
|
|
700
|
-
Array.from(views).sort(),
|
|
701
|
-
Array.from(field.views).sort()))) {
|
|
704
|
+
views_operator(new Set(field.views)))) {
|
|
702
705
|
fnames.push(fname);
|
|
703
706
|
}
|
|
704
707
|
}
|
package/src/sao.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
/* eslint-disable no-redeclare */
|
|
5
5
|
var Sao = {
|
|
6
|
-
__version__: '7.2.
|
|
6
|
+
__version__: '7.2.4',
|
|
7
7
|
};
|
|
8
8
|
/* eslint-enable no-redeclare */
|
|
9
9
|
|
|
@@ -107,6 +107,35 @@ var Sao = {
|
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
if (!Set.prototype.intersection) {
|
|
111
|
+
Set.prototype.intersection = function(other) {
|
|
112
|
+
if (this === null) {
|
|
113
|
+
throw new TypeError();
|
|
114
|
+
}
|
|
115
|
+
const result = new Set();
|
|
116
|
+
for (const key of other.keys()) {
|
|
117
|
+
if (this.has(key)) {
|
|
118
|
+
result.add(key)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (!Set.prototype.isSubsetOf) {
|
|
126
|
+
Set.prototype.isSubsetOf = function(other) {
|
|
127
|
+
if (this === null) {
|
|
128
|
+
throw new TypeError();
|
|
129
|
+
}
|
|
130
|
+
for (const key of this.keys()) {
|
|
131
|
+
if (!other.has(key)) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
110
139
|
Sao.setdefault = function(object, key, value) {
|
|
111
140
|
if (!Object.prototype.hasOwnProperty.call(object, key)) {
|
|
112
141
|
object[key] = value;
|
package/src/sao.less
CHANGED
|
@@ -876,12 +876,16 @@ img.icon {
|
|
|
876
876
|
}
|
|
877
877
|
}
|
|
878
878
|
.form-text, .form-richtext {
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
879
|
+
.input-group {
|
|
880
|
+
width: 100%;
|
|
881
|
+
|
|
882
|
+
textarea, .richtext {
|
|
883
|
+
height: 100%;
|
|
884
|
+
line-height: 2.5ex;
|
|
885
|
+
min-height: 12.5ex;
|
|
886
|
+
overflow: auto;
|
|
887
|
+
resize: vertical;
|
|
888
|
+
}
|
|
885
889
|
}
|
|
886
890
|
}
|
|
887
891
|
.form-richtext {
|
package/src/screen.js
CHANGED
|
@@ -794,9 +794,7 @@
|
|
|
794
794
|
this.views = [];
|
|
795
795
|
this.views_preload = attributes.views_preload || {};
|
|
796
796
|
this.exclude_field = attributes.exclude_field;
|
|
797
|
-
this.new_group(attributes.context || {});
|
|
798
797
|
this.current_view = null;
|
|
799
|
-
this.current_record = null;
|
|
800
798
|
this.domain = attributes.domain || [];
|
|
801
799
|
this.context_domain = attributes.context_domain;
|
|
802
800
|
this.size_limit = null;
|
|
@@ -808,11 +806,14 @@
|
|
|
808
806
|
this._current_domain = [];
|
|
809
807
|
this.offset = 0;
|
|
810
808
|
this.order = this.default_order = attributes.order;
|
|
809
|
+
this.readonly = this.attributes.readonly || false;
|
|
811
810
|
var access = Sao.common.MODELACCESS.get(model_name);
|
|
812
811
|
if (!(access.write || access.create)) {
|
|
813
|
-
this.
|
|
812
|
+
this.readonly = true;
|
|
814
813
|
}
|
|
815
814
|
this.search_count = 0;
|
|
815
|
+
this.new_group(attributes.context || {});
|
|
816
|
+
this.current_record = null;
|
|
816
817
|
this.screen_container = new Sao.ScreenContainer(
|
|
817
818
|
attributes.tab_domain);
|
|
818
819
|
this.breadcrumb = attributes.breadcrumb || [];
|
|
@@ -855,7 +856,10 @@
|
|
|
855
856
|
var readonly_records = this.selected_records.some(function(r) {
|
|
856
857
|
return r.readonly;
|
|
857
858
|
});
|
|
858
|
-
return this.
|
|
859
|
+
return this.__readonly || readonly_records;
|
|
860
|
+
},
|
|
861
|
+
set readonly(value) {
|
|
862
|
+
this.__readonly = value;
|
|
859
863
|
},
|
|
860
864
|
get deletable() {
|
|
861
865
|
return this.selected_records.every(function(r) {
|
|
@@ -1233,7 +1237,7 @@
|
|
|
1233
1237
|
context = this.context;
|
|
1234
1238
|
}
|
|
1235
1239
|
var group = new Sao.Group(this.model, context, []);
|
|
1236
|
-
group.readonly = this.
|
|
1240
|
+
group.readonly = this.__readonly;
|
|
1237
1241
|
this.set_group(group);
|
|
1238
1242
|
},
|
|
1239
1243
|
record_modified: function(display=true) {
|
package/src/tab.js
CHANGED
|
@@ -158,7 +158,9 @@
|
|
|
158
158
|
this.menu_buttons[item.id] = menuitem;
|
|
159
159
|
link.click(evt => {
|
|
160
160
|
evt.preventDefault();
|
|
161
|
-
|
|
161
|
+
if (!menuitem.hasClass('disabled')) {
|
|
162
|
+
this[item.id]();
|
|
163
|
+
}
|
|
162
164
|
});
|
|
163
165
|
} else if (!item && previous) {
|
|
164
166
|
menuitem = jQuery('<li/>', {
|
|
@@ -1254,7 +1256,7 @@
|
|
|
1254
1256
|
this.refresh_resources(true);
|
|
1255
1257
|
});
|
|
1256
1258
|
for (const file of files) {
|
|
1257
|
-
Sao.common.get_file_data(file, window_.add_data);
|
|
1259
|
+
Sao.common.get_file_data(file, window_.add_data.bind(window_));
|
|
1258
1260
|
}
|
|
1259
1261
|
jQuery.when.apply(jQuery, uris).then(function() {
|
|
1260
1262
|
function empty(value) {
|
package/src/view/calendar.js
CHANGED
|
@@ -346,17 +346,26 @@
|
|
|
346
346
|
if (!this.start && !this.end) {
|
|
347
347
|
return [['id', '=', -1]];
|
|
348
348
|
}
|
|
349
|
-
var
|
|
350
|
-
var
|
|
349
|
+
var start = Sao.DateTime(this.start);
|
|
350
|
+
var end = Sao.DateTime(this.end);
|
|
351
351
|
var dtstart = this.attributes.dtstart;
|
|
352
352
|
var dtend = this.attributes.dtend || dtstart;
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
353
|
+
var fields = this.screen.model.fields;
|
|
354
|
+
if (fields[dtstart].description.type == 'date') {
|
|
355
|
+
start = start.todate();
|
|
356
|
+
}
|
|
357
|
+
if (fields[dtend].description.type == 'date') {
|
|
358
|
+
end = end.todate();
|
|
359
|
+
}
|
|
360
|
+
return [
|
|
361
|
+
[dtstart, '!=', null],
|
|
362
|
+
[dtend, '!=', null],
|
|
363
|
+
['OR',
|
|
364
|
+
['AND', [dtstart, '>=', start], [dtstart, '<', end]],
|
|
365
|
+
['AND', [dtend, '>=', start], [dtend, '<', end]],
|
|
366
|
+
['AND', [dtstart, '<', start], [dtend, '>', end]],
|
|
367
|
+
],
|
|
368
|
+
];
|
|
360
369
|
},
|
|
361
370
|
get_displayed_period: function(){
|
|
362
371
|
var DatesPeriod = [];
|
package/src/view/tree.js
CHANGED
|
@@ -728,7 +728,7 @@
|
|
|
728
728
|
},
|
|
729
729
|
display: function(selected, expanded) {
|
|
730
730
|
var current_record = this.record;
|
|
731
|
-
if (jQuery.isEmptyObject(selected)) {
|
|
731
|
+
if (jQuery.isEmptyObject(selected) && current_record) {
|
|
732
732
|
selected = this.get_selected_paths();
|
|
733
733
|
if (this.selection.prop('checked') &&
|
|
734
734
|
!this.selection.prop('indeterminate')) {
|
|
@@ -737,16 +737,12 @@
|
|
|
737
737
|
selected.push([record.id]);
|
|
738
738
|
}
|
|
739
739
|
} else {
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
selected = [current_path];
|
|
747
|
-
}
|
|
748
|
-
} else if (!current_record) {
|
|
749
|
-
selected = [];
|
|
740
|
+
var current_path = current_record.get_path(this.group);
|
|
741
|
+
current_path = current_path.map(function(e) {
|
|
742
|
+
return e[1];
|
|
743
|
+
});
|
|
744
|
+
if (!Sao.common.contains(selected, current_path)) {
|
|
745
|
+
selected = [current_path];
|
|
750
746
|
}
|
|
751
747
|
}
|
|
752
748
|
}
|
|
@@ -1327,7 +1323,10 @@
|
|
|
1327
1323
|
if (this.editable && new_) {
|
|
1328
1324
|
td.trigger('click');
|
|
1329
1325
|
}
|
|
1330
|
-
|
|
1326
|
+
var child = Sao.common.find_focusable_child(td);
|
|
1327
|
+
if (child) {
|
|
1328
|
+
child.focus();
|
|
1329
|
+
}
|
|
1331
1330
|
}
|
|
1332
1331
|
}
|
|
1333
1332
|
};
|
package/src/window.js
CHANGED
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
}
|
|
180
180
|
});
|
|
181
181
|
|
|
182
|
-
var readonly = this.screen.
|
|
182
|
+
var readonly = this.screen.group.readonly;
|
|
183
183
|
|
|
184
184
|
this.but_ok = null;
|
|
185
185
|
this.but_new = null;
|
|
@@ -406,7 +406,7 @@
|
|
|
406
406
|
var name = '_';
|
|
407
407
|
var access = Sao.common.MODELACCESS.get(this.screen.model_name);
|
|
408
408
|
var deletable = this.screen.deletable;
|
|
409
|
-
var readonly = this.screen.
|
|
409
|
+
var readonly = this.screen.group.readonly;
|
|
410
410
|
if (position >= 1) {
|
|
411
411
|
name = position;
|
|
412
412
|
if (this.domain) {
|
|
@@ -414,10 +414,12 @@
|
|
|
414
414
|
}
|
|
415
415
|
this.but_next.prop('disabled', position >= size);
|
|
416
416
|
this.but_previous.prop('disabled', position <= 1);
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
417
|
+
this.but_del.prop(
|
|
418
|
+
'disabled',
|
|
419
|
+
readonly ||
|
|
420
|
+
!access.delete ||
|
|
421
|
+
!deletable);
|
|
422
|
+
this.but_undel.prop('disabled', readonly);
|
|
421
423
|
} else {
|
|
422
424
|
this.but_del.prop('disabled', true);
|
|
423
425
|
this.but_undel.prop('disabled', true);
|
|
@@ -490,7 +492,7 @@
|
|
|
490
492
|
response: function(response_id) {
|
|
491
493
|
var result;
|
|
492
494
|
this.screen.current_view.set_value();
|
|
493
|
-
var readonly = this.screen.
|
|
495
|
+
var readonly = this.screen.group.readonly;
|
|
494
496
|
if (~['RESPONSE_OK', 'RESPONSE_ACCEPT'].indexOf(response_id) &&
|
|
495
497
|
!readonly &&
|
|
496
498
|
this.screen.current_record) {
|
|
@@ -918,8 +920,14 @@
|
|
|
918
920
|
this.title = title;
|
|
919
921
|
this.exclude_field = kwargs.exclude_field || null;
|
|
920
922
|
var dialog = new Sao.Dialog(Sao.i18n.gettext(
|
|
921
|
-
'Search %1', this.title), '', 'lg');
|
|
923
|
+
'Search %1', this.title), '', 'lg', false);
|
|
922
924
|
this.el = dialog.modal;
|
|
925
|
+
this.el.on('keydown', e => {
|
|
926
|
+
if (e.which == Sao.common.ESC_KEYCODE) {
|
|
927
|
+
e.preventDefault();
|
|
928
|
+
this.response('RESPONSE_CANCEL');
|
|
929
|
+
}
|
|
930
|
+
});
|
|
923
931
|
|
|
924
932
|
jQuery('<button/>', {
|
|
925
933
|
'class': 'btn btn-link',
|
|
@@ -995,7 +1003,8 @@
|
|
|
995
1003
|
if (response_id == 'RESPONSE_OK') {
|
|
996
1004
|
records = this.screen.current_view.selected_records;
|
|
997
1005
|
} else if (response_id == 'RESPONSE_APPLY') {
|
|
998
|
-
this.screen.search_filter(
|
|
1006
|
+
this.screen.search_filter(
|
|
1007
|
+
this.screen.screen_container.get_text());
|
|
999
1008
|
return;
|
|
1000
1009
|
} else if (response_id == 'RESPONSE_ACCEPT') {
|
|
1001
1010
|
var view_ids = jQuery.extend([], this.view_ids);
|
package/src/wizard.js
CHANGED
|
@@ -316,7 +316,8 @@
|
|
|
316
316
|
}
|
|
317
317
|
if (!dialog ||
|
|
318
318
|
!this.model ||
|
|
319
|
-
(Sao.main_menu_screen
|
|
319
|
+
(Sao.main_menu_screen &&
|
|
320
|
+
(Sao.main_menu_screen.model_name == this.model))) {
|
|
320
321
|
is_menu = true;
|
|
321
322
|
screen = Sao.main_menu_screen;
|
|
322
323
|
} else {
|