tryton-sao 6.0.16 → 6.0.19
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 +9 -0
- package/dist/tryton-sao.js +51 -49
- package/dist/tryton-sao.min.js +2 -2
- package/package.json +1 -1
- package/src/common.js +17 -20
- package/src/html_sanitizer.js +3 -0
- package/src/model.js +14 -13
- package/src/view/form.js +4 -4
- package/src/view/list_form.js +1 -1
- package/src/view/tree.js +8 -7
- package/src/window.js +4 -4
- package/tests/sao.js +3 -0
package/CHANGELOG
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
Version 6.0.19 - 2022-06-15
|
|
2
|
+
* Bug fixes (see mercurial logs for details)
|
|
3
|
+
|
|
4
|
+
Version 6.0.18 - 2022-06-03
|
|
5
|
+
* Bug fixes (see mercurial logs for details)
|
|
6
|
+
|
|
7
|
+
Version 6.0.17 - 2022-05-06
|
|
8
|
+
* Bug fixes (see mercurial logs for details)
|
|
9
|
+
|
|
1
10
|
Version 6.0.16 - 2022-04-15
|
|
2
11
|
* Bug fixes (see mercurial logs for details)
|
|
3
12
|
|
package/dist/tryton-sao.js
CHANGED
|
@@ -3190,7 +3190,7 @@ var Sao = {};
|
|
|
3190
3190
|
};
|
|
3191
3191
|
|
|
3192
3192
|
Sao.common.parse_time = function(format, value) {
|
|
3193
|
-
if (
|
|
3193
|
+
if (!value) {
|
|
3194
3194
|
return null;
|
|
3195
3195
|
}
|
|
3196
3196
|
var getNumber = function(pattern) {
|
|
@@ -4227,7 +4227,7 @@ var Sao = {};
|
|
|
4227
4227
|
|
|
4228
4228
|
var pslice = function(string, depth) {
|
|
4229
4229
|
if (depth > 0) {
|
|
4230
|
-
return string.substring(0, depth);
|
|
4230
|
+
return string.substring(0, string.length - depth);
|
|
4231
4231
|
}
|
|
4232
4232
|
return string;
|
|
4233
4233
|
};
|
|
@@ -4337,8 +4337,8 @@ var Sao = {};
|
|
|
4337
4337
|
}
|
|
4338
4338
|
return results;
|
|
4339
4339
|
},
|
|
4340
|
-
|
|
4341
|
-
return (
|
|
4340
|
+
is_subdomain: function(element) {
|
|
4341
|
+
return (element instanceof Array) && !element.clause;
|
|
4342
4342
|
},
|
|
4343
4343
|
ending_clause: function(domain, depth) {
|
|
4344
4344
|
if (depth === undefined) {
|
|
@@ -4348,7 +4348,7 @@ var Sao = {};
|
|
|
4348
4348
|
return [null, depth];
|
|
4349
4349
|
}
|
|
4350
4350
|
var last_element = domain[domain.length - 1];
|
|
4351
|
-
if (
|
|
4351
|
+
if (this.is_subdomain(last_element)) {
|
|
4352
4352
|
return this.ending_clause(last_element, depth + 1);
|
|
4353
4353
|
}
|
|
4354
4354
|
return [last_element, depth];
|
|
@@ -4359,9 +4359,9 @@ var Sao = {};
|
|
|
4359
4359
|
for (i = 0, len=domain.length - 1; i < len; i++) {
|
|
4360
4360
|
results.push(domain[i]);
|
|
4361
4361
|
}
|
|
4362
|
-
if (
|
|
4363
|
-
results
|
|
4364
|
-
|
|
4362
|
+
if (this.is_subdomain(domain[i])) {
|
|
4363
|
+
results.push(
|
|
4364
|
+
this.replace_ending_clause(domain[i], clause));
|
|
4365
4365
|
} else {
|
|
4366
4366
|
results.push(clause);
|
|
4367
4367
|
}
|
|
@@ -4373,7 +4373,7 @@ var Sao = {};
|
|
|
4373
4373
|
}
|
|
4374
4374
|
var results = domain.slice(0, -1);
|
|
4375
4375
|
var last_element = domain[domain.length - 1];
|
|
4376
|
-
if (
|
|
4376
|
+
if (this.is_subdomain(last_element)) {
|
|
4377
4377
|
results.push(this.append_ending_clause(last_element, clause,
|
|
4378
4378
|
depth - 1));
|
|
4379
4379
|
} else {
|
|
@@ -5114,19 +5114,17 @@ var Sao = {};
|
|
|
5114
5114
|
}
|
|
5115
5115
|
},
|
|
5116
5116
|
simplify: function(value) {
|
|
5117
|
-
if (
|
|
5118
|
-
if ((value.length == 1) && (value[0]
|
|
5119
|
-
((value[0][0] == 'AND') || (value[0][0] == 'OR') ||
|
|
5120
|
-
(value[0][0] instanceof Array))) {
|
|
5117
|
+
if (this.is_subdomain(value)) {
|
|
5118
|
+
if ((value.length == 1) && this.is_subdomain(value[0])) {
|
|
5121
5119
|
return this.simplify(value[0]);
|
|
5122
5120
|
} else if ((value.length == 2) &&
|
|
5123
|
-
|
|
5124
|
-
|
|
5121
|
+
((value[0] == 'AND') || (value[0] == 'OR')) &&
|
|
5122
|
+
this.is_subdomain(value[1])) {
|
|
5125
5123
|
return this.simplify(value[1]);
|
|
5126
5124
|
} else if ((value.length == 3) &&
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5125
|
+
((value[0] == 'AND') || (value[0] == 'OR')) &&
|
|
5126
|
+
this.is_subdomain(value[1]) &&
|
|
5127
|
+
(value[0] == value[1][0])) {
|
|
5130
5128
|
value = this.simplify(value[1]).concat([value[2]]);
|
|
5131
5129
|
}
|
|
5132
5130
|
return value.map(this.simplify.bind(this));
|
|
@@ -6736,8 +6734,7 @@ var Sao = {};
|
|
|
6736
6734
|
|
|
6737
6735
|
Sao.common.download_file = function(data, name, options) {
|
|
6738
6736
|
if (options === undefined) {
|
|
6739
|
-
var type = Sao.common.guess_mimetype(
|
|
6740
|
-
name ? name.split('.').pop() : undefined);
|
|
6737
|
+
var type = Sao.common.guess_mimetype(name);
|
|
6741
6738
|
options = {type: type};
|
|
6742
6739
|
}
|
|
6743
6740
|
var blob = new Blob([data], options);
|
|
@@ -8077,10 +8074,11 @@ var Sao = {};
|
|
|
8077
8074
|
this.on_change_with(fieldnames);
|
|
8078
8075
|
var callback = function() {
|
|
8079
8076
|
if (display) {
|
|
8080
|
-
return
|
|
8081
|
-
.
|
|
8077
|
+
return jQuery.when.apply(
|
|
8078
|
+
jQuery, this.group.root_group.screens
|
|
8079
|
+
.map(function(screen) {
|
|
8082
8080
|
return screen.display();
|
|
8083
|
-
});
|
|
8081
|
+
}));
|
|
8084
8082
|
}
|
|
8085
8083
|
}.bind(this);
|
|
8086
8084
|
if (validate) {
|
|
@@ -8881,10 +8879,8 @@ var Sao = {};
|
|
|
8881
8879
|
value = null;
|
|
8882
8880
|
}
|
|
8883
8881
|
} else if (value.isDate) {
|
|
8884
|
-
current_value = this.get(record);
|
|
8885
|
-
|
|
8886
|
-
value = Sao.DateTime.combine(value, current_value);
|
|
8887
|
-
}
|
|
8882
|
+
current_value = this.get(record) || Sao.Time();
|
|
8883
|
+
value = Sao.DateTime.combine(value, current_value);
|
|
8888
8884
|
}
|
|
8889
8885
|
}
|
|
8890
8886
|
Sao.field.DateTime._super.set_client.call(this, record, value,
|
|
@@ -9365,7 +9361,7 @@ var Sao = {};
|
|
|
9365
9361
|
if (value instanceof Array) {
|
|
9366
9362
|
return this._set_value(record, value, false, true);
|
|
9367
9363
|
}
|
|
9368
|
-
if (value.add || value.update) {
|
|
9364
|
+
if (value && (value.add || value.update)) {
|
|
9369
9365
|
var context = this.get_context(record);
|
|
9370
9366
|
fields = record._values[this.name].model.fields;
|
|
9371
9367
|
var new_field_names = {};
|
|
@@ -9405,7 +9401,7 @@ var Sao = {};
|
|
|
9405
9401
|
}
|
|
9406
9402
|
|
|
9407
9403
|
var group = record._values[this.name];
|
|
9408
|
-
if (value.delete) {
|
|
9404
|
+
if (value && value.delete) {
|
|
9409
9405
|
value.delete.forEach(function(record_id) {
|
|
9410
9406
|
var record2 = group.get(record_id);
|
|
9411
9407
|
if (record2) {
|
|
@@ -9413,7 +9409,7 @@ var Sao = {};
|
|
|
9413
9409
|
}
|
|
9414
9410
|
}.bind(this));
|
|
9415
9411
|
}
|
|
9416
|
-
if (value.remove) {
|
|
9412
|
+
if (value && value.remove) {
|
|
9417
9413
|
value.remove.forEach(function(record_id) {
|
|
9418
9414
|
var record2 = group.get(record_id);
|
|
9419
9415
|
if (record2) {
|
|
@@ -9422,7 +9418,7 @@ var Sao = {};
|
|
|
9422
9418
|
}.bind(this));
|
|
9423
9419
|
}
|
|
9424
9420
|
|
|
9425
|
-
if (value.add || value.update) {
|
|
9421
|
+
if (value && (value.add || value.update)) {
|
|
9426
9422
|
// First set already added fields to prevent triggering a
|
|
9427
9423
|
// second on_change call
|
|
9428
9424
|
if (value.update) {
|
|
@@ -9748,7 +9744,8 @@ var Sao = {};
|
|
|
9748
9744
|
},
|
|
9749
9745
|
get_size: function(record) {
|
|
9750
9746
|
var data = record._values[this.name] || 0;
|
|
9751
|
-
if (data instanceof Uint8Array)
|
|
9747
|
+
if ((data instanceof Uint8Array) ||
|
|
9748
|
+
(typeof(data) == 'string')) {
|
|
9752
9749
|
return data.length;
|
|
9753
9750
|
}
|
|
9754
9751
|
return data;
|
|
@@ -9756,7 +9753,8 @@ var Sao = {};
|
|
|
9756
9753
|
get_data: function(record) {
|
|
9757
9754
|
var data = record._values[this.name] || [];
|
|
9758
9755
|
var prm = jQuery.when(data);
|
|
9759
|
-
if (!(data instanceof Uint8Array)
|
|
9756
|
+
if (!(data instanceof Uint8Array) &&
|
|
9757
|
+
(typeof(data) != 'string')) {
|
|
9760
9758
|
if (record.id < 0) {
|
|
9761
9759
|
return prm;
|
|
9762
9760
|
}
|
|
@@ -15681,7 +15679,7 @@ function eval_pyson(value){
|
|
|
15681
15679
|
this.date.val(this._format(this.get_format(), value));
|
|
15682
15680
|
},
|
|
15683
15681
|
focus: function() {
|
|
15684
|
-
this.
|
|
15682
|
+
this.date.focus();
|
|
15685
15683
|
},
|
|
15686
15684
|
get modified() {
|
|
15687
15685
|
if (this.record && this.field) {
|
|
@@ -16547,7 +16545,7 @@ function eval_pyson(value){
|
|
|
16547
16545
|
if (this.has_target(value)) {
|
|
16548
16546
|
var m2o_id =
|
|
16549
16547
|
this.id_from_value(record.field_get(this.field_name));
|
|
16550
|
-
if (evt && evt.ctrlKey) {
|
|
16548
|
+
if (evt && (evt.ctrlKey || evt.metaKey)) {
|
|
16551
16549
|
var params = {};
|
|
16552
16550
|
params.model = this.get_model();
|
|
16553
16551
|
params.res_id = m2o_id;
|
|
@@ -18149,8 +18147,8 @@ function eval_pyson(value){
|
|
|
18149
18147
|
},
|
|
18150
18148
|
set_readonly: function(readonly) {
|
|
18151
18149
|
Sao.View.Form.Image._super.set_readonly.call(this, readonly);
|
|
18152
|
-
this.but_select.prop('
|
|
18153
|
-
this.but_clear.prop('
|
|
18150
|
+
this.but_select.prop('disabled', readonly);
|
|
18151
|
+
this.but_clear.prop('disabled', readonly);
|
|
18154
18152
|
},
|
|
18155
18153
|
clear: function() {
|
|
18156
18154
|
Sao.View.Form.Image._super.clear.call(this);
|
|
@@ -19591,7 +19589,7 @@ function eval_pyson(value){
|
|
|
19591
19589
|
|
|
19592
19590
|
var parent_row = null;
|
|
19593
19591
|
var dest_position;
|
|
19594
|
-
if (evt.ctrlKey && this.children_field) {
|
|
19592
|
+
if ((evt.ctrlKey || evt.metaKey) && this.children_field) {
|
|
19595
19593
|
parent_row = this._find_row(row.el.prev());
|
|
19596
19594
|
dest_position = (parent_row || this).rows.length;
|
|
19597
19595
|
} else {
|
|
@@ -19895,8 +19893,6 @@ function eval_pyson(value){
|
|
|
19895
19893
|
}.bind(this));
|
|
19896
19894
|
this.table.css('min-width', 'calc(' + min_width.join(' + ') + ')');
|
|
19897
19895
|
this.scrollbar.css('min-width', this.table.css('min-width'));
|
|
19898
|
-
this.tbody.find('tr.more-row > td').attr(
|
|
19899
|
-
'colspan', visible_columns);
|
|
19900
19896
|
|
|
19901
19897
|
if (!this.table.hasClass('no-responsive') &
|
|
19902
19898
|
(this.columns.filter(function(c) {
|
|
@@ -19926,7 +19922,9 @@ function eval_pyson(value){
|
|
|
19926
19922
|
var more_row = jQuery('<tr/>', {
|
|
19927
19923
|
'class': 'more-row',
|
|
19928
19924
|
});
|
|
19929
|
-
var more_cell = jQuery('<td/>'
|
|
19925
|
+
var more_cell = jQuery('<td/>', {
|
|
19926
|
+
'colspan': visible_columns,
|
|
19927
|
+
});
|
|
19930
19928
|
var more_button = jQuery('<button/>', {
|
|
19931
19929
|
'class': 'btn btn-default btn-block',
|
|
19932
19930
|
'type': 'button'
|
|
@@ -20781,7 +20779,7 @@ function eval_pyson(value){
|
|
|
20781
20779
|
current_record = this.tree.screen.current_record;
|
|
20782
20780
|
this.tree.select_records(current_record, this.record);
|
|
20783
20781
|
} else {
|
|
20784
|
-
if (!event_.ctrlKey ||
|
|
20782
|
+
if (!(event_.ctrlKey || event_.metaKey) ||
|
|
20785
20783
|
this.tree.selection_mode ==
|
|
20786
20784
|
Sao.common.SELECTION_SINGLE) {
|
|
20787
20785
|
this.tree.select_records(null, null);
|
|
@@ -20968,7 +20966,7 @@ function eval_pyson(value){
|
|
|
20968
20966
|
|
|
20969
20967
|
Sao.View.Tree.RowEditable._super.select_row.call(this, event_);
|
|
20970
20968
|
|
|
20971
|
-
if (!event_.shiftKey && !event_.ctrlKey) {
|
|
20969
|
+
if (!event_.shiftKey && !(event_.ctrlKey || event_.metaKey)) {
|
|
20972
20970
|
this.tree.edit_row(this);
|
|
20973
20971
|
}
|
|
20974
20972
|
},
|
|
@@ -21045,7 +21043,8 @@ function eval_pyson(value){
|
|
|
21045
21043
|
(event_.which != Sao.common.DOWN_KEYCODE) &&
|
|
21046
21044
|
(event_.which != Sao.common.ESC_KEYCODE) &&
|
|
21047
21045
|
(event_.which != Sao.common.RETURN_KEYCODE)) ||
|
|
21048
|
-
jQuery(event_.currentTarget)
|
|
21046
|
+
jQuery(event_.currentTarget)
|
|
21047
|
+
.find('.dropdown-menu:visible').length) {
|
|
21049
21048
|
return;
|
|
21050
21049
|
}
|
|
21051
21050
|
var td = this._get_column_td(this.edited_column);
|
|
@@ -22869,7 +22868,7 @@ function eval_pyson(value){
|
|
|
22869
22868
|
}
|
|
22870
22869
|
this.select_records(i, view_form_idx);
|
|
22871
22870
|
} else {
|
|
22872
|
-
if (!event_.ctrlKey) {
|
|
22871
|
+
if (!(event_.ctrlKey || event_.metaKey)) {
|
|
22873
22872
|
this.select_records(null, null);
|
|
22874
22873
|
}
|
|
22875
22874
|
this.record = view_form.record;
|
|
@@ -24381,7 +24380,7 @@ function eval_pyson(value){
|
|
|
24381
24380
|
}).text(el_field.attr('name')).prepend(
|
|
24382
24381
|
Sao.common.ICONFACTORY.get_icon_img('tryton-drag')
|
|
24383
24382
|
).click(function(e) {
|
|
24384
|
-
if (e.ctrlKey) {
|
|
24383
|
+
if (e.ctrlKey || e.metaKey) {
|
|
24385
24384
|
node.toggleClass('bg-primary');
|
|
24386
24385
|
} else {
|
|
24387
24386
|
jQuery(e.target).addClass('bg-primary')
|
|
@@ -24405,7 +24404,7 @@ function eval_pyson(value){
|
|
|
24405
24404
|
'field': parent_node[field].field,
|
|
24406
24405
|
'name': parent_node[field].name
|
|
24407
24406
|
}).text(name).click(function(e) {
|
|
24408
|
-
if(e.ctrlKey) {
|
|
24407
|
+
if (e.ctrlKey || e.metaKey) {
|
|
24409
24408
|
node.toggleClass('bg-primary');
|
|
24410
24409
|
} else {
|
|
24411
24410
|
this.fields_all.find('li').removeClass('bg-primary');
|
|
@@ -24761,7 +24760,7 @@ function eval_pyson(value){
|
|
|
24761
24760
|
var node = jQuery('<li/>', {
|
|
24762
24761
|
'path': path
|
|
24763
24762
|
}).text(parent_node[name].string).click(function(e) {
|
|
24764
|
-
if(e.ctrlKey) {
|
|
24763
|
+
if (e.ctrlKey || e.metaKey) {
|
|
24765
24764
|
node.toggleClass('bg-primary');
|
|
24766
24765
|
} else {
|
|
24767
24766
|
this.fields_all.find('li')
|
|
@@ -25010,7 +25009,7 @@ function eval_pyson(value){
|
|
|
25010
25009
|
'path': name,
|
|
25011
25010
|
'class': 'draggable-handle',
|
|
25012
25011
|
}).text(long_string).click(function(e) {
|
|
25013
|
-
if(e.ctrlKey) {
|
|
25012
|
+
if (e.ctrlKey || e.metaKey) {
|
|
25014
25013
|
node.toggleClass('bg-primary');
|
|
25015
25014
|
} else {
|
|
25016
25015
|
jQuery(e.target).addClass('bg-primary')
|
|
@@ -26282,6 +26281,9 @@ SOFTWARE.
|
|
|
26282
26281
|
}
|
|
26283
26282
|
} else {
|
|
26284
26283
|
new_node = document.createDocumentFragment();
|
|
26284
|
+
if (node.tagName != 'SCRIPT') {
|
|
26285
|
+
new_node.textContent = node.textContent;
|
|
26286
|
+
}
|
|
26285
26287
|
}
|
|
26286
26288
|
return new_node;
|
|
26287
26289
|
}
|