tryton-sao 5.8.10 → 5.8.14
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 +12 -0
- package/COPYRIGHT +2 -2
- package/dist/tryton-sao.js +108 -33
- package/dist/tryton-sao.min.js +2 -2
- package/package.json +1 -1
- package/src/board.js +1 -0
- package/src/common.js +34 -6
- package/src/model.js +7 -1
- package/src/tab.js +49 -17
- package/src/view/form.js +9 -0
- package/src/view/tree.js +8 -9
- package/tests/sao.js +1 -1
package/CHANGELOG
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
Version 5.8.14 - 2021-10-01
|
|
2
|
+
* Bug fixes (see mercurial logs for details)
|
|
3
|
+
|
|
4
|
+
Version 5.8.13 - 2021-09-16
|
|
5
|
+
* Bug fixes (see mercurial logs for details)
|
|
6
|
+
|
|
7
|
+
Version 5.8.12 - 2021-09-01
|
|
8
|
+
* Bug fixes (see mercurial logs for details)
|
|
9
|
+
|
|
10
|
+
Version 5.8.11 - 2021-07-21
|
|
11
|
+
* Bug fixes (see mercurial logs for details)
|
|
12
|
+
|
|
1
13
|
Version 5.8.10 - 2021-07-01
|
|
2
14
|
* Bug fixes (see mercurial logs for details)
|
|
3
15
|
|
package/COPYRIGHT
CHANGED
|
@@ -4,8 +4,8 @@ Copyright (C) 2012-2014 Bertrand Chenal.
|
|
|
4
4
|
Copyright (C) 2012-2021 B2CK SPRL.
|
|
5
5
|
Copyright (C) 2019 Jitbit.
|
|
6
6
|
Copyright (C) 2013 Thomas Park
|
|
7
|
-
Copyright (C) 2020 Maxime Richez
|
|
8
|
-
Copyright (C) 2020 SALUC SA
|
|
7
|
+
Copyright (C) 2020-2021 Maxime Richez
|
|
8
|
+
Copyright (C) 2020-2021 SALUC SA
|
|
9
9
|
|
|
10
10
|
This program is free software: you can redistribute it and/or modify
|
|
11
11
|
it under the terms of the GNU General Public License as published by
|
package/dist/tryton-sao.js
CHANGED
|
@@ -4402,6 +4402,7 @@ var Sao = {};
|
|
|
4402
4402
|
case 'numeric':
|
|
4403
4403
|
return Sao.field.Numeric;
|
|
4404
4404
|
case 'integer':
|
|
4405
|
+
case 'biginteger':
|
|
4405
4406
|
return Sao.field.Integer;
|
|
4406
4407
|
case 'boolean':
|
|
4407
4408
|
return Sao.field.Boolean;
|
|
@@ -5057,12 +5058,17 @@ var Sao = {};
|
|
|
5057
5058
|
}
|
|
5058
5059
|
}
|
|
5059
5060
|
if (mode == 'list ids') {
|
|
5061
|
+
var records_to_remove = [];
|
|
5060
5062
|
for (var i = 0, len = group.length; i < len; i++) {
|
|
5061
5063
|
var old_record = group[i];
|
|
5062
5064
|
if (!~value.indexOf(old_record.id)) {
|
|
5063
|
-
|
|
5065
|
+
records_to_remove.push(old_record);
|
|
5064
5066
|
}
|
|
5065
5067
|
}
|
|
5068
|
+
for (i = 0, len = records_to_remove.length; i < len; i++) {
|
|
5069
|
+
var record_to_remove = records_to_remove[i];
|
|
5070
|
+
group.remove(record_to_remove, true, true, false, false);
|
|
5071
|
+
}
|
|
5066
5072
|
group.load(value, modified || default_);
|
|
5067
5073
|
} else {
|
|
5068
5074
|
value.forEach(function(vals) {
|
|
@@ -6143,6 +6149,12 @@ var Sao = {};
|
|
|
6143
6149
|
id: tab.id
|
|
6144
6150
|
}).append(tab.el)
|
|
6145
6151
|
.appendTo(tabcontent);
|
|
6152
|
+
tab_link.on('hide.bs.tab', function(evt) {
|
|
6153
|
+
jQuery(evt.target).data('scrollTop', tabs.scrollTop());
|
|
6154
|
+
});
|
|
6155
|
+
tab_link.on('shown.bs.tab', function(evt) {
|
|
6156
|
+
tabs.scrollTop(jQuery(evt.target).data('scrollTop') || 0);
|
|
6157
|
+
});
|
|
6146
6158
|
tab_link.tab('show');
|
|
6147
6159
|
tabs.trigger('ready');
|
|
6148
6160
|
};
|
|
@@ -6224,7 +6236,6 @@ var Sao = {};
|
|
|
6224
6236
|
create_toolbar: function() {
|
|
6225
6237
|
var toolbar = Sao.Tab.Form._super.create_toolbar.call(this);
|
|
6226
6238
|
var screen = this.screen;
|
|
6227
|
-
var buttons = this.buttons;
|
|
6228
6239
|
var prm = screen.model.execute('view_toolbar_get', [],
|
|
6229
6240
|
screen.context);
|
|
6230
6241
|
prm.done(function(toolbars) {
|
|
@@ -6236,7 +6247,7 @@ var Sao = {};
|
|
|
6236
6247
|
['print', 'tryton-print',
|
|
6237
6248
|
Sao.i18n.gettext('Print report')]
|
|
6238
6249
|
].forEach(function(menu_action) {
|
|
6239
|
-
var
|
|
6250
|
+
var dropdown = jQuery('<div/>', {
|
|
6240
6251
|
'class': 'btn-group dropdown',
|
|
6241
6252
|
'role': 'group'
|
|
6242
6253
|
})
|
|
@@ -6262,8 +6273,9 @@ var Sao = {};
|
|
|
6262
6273
|
'aria-labelledby': menu_action[0]
|
|
6263
6274
|
}))
|
|
6264
6275
|
.insertBefore(toolbar.find('button#email'));
|
|
6265
|
-
|
|
6266
|
-
|
|
6276
|
+
var button = dropdown.find('button');
|
|
6277
|
+
this.buttons[menu_action[0]] = button;
|
|
6278
|
+
dropdown
|
|
6267
6279
|
.on('show.bs.dropdown', function() {
|
|
6268
6280
|
jQuery(this).parents('.btn-group').removeClass(
|
|
6269
6281
|
'hidden-xs');
|
|
@@ -6271,7 +6283,7 @@ var Sao = {};
|
|
|
6271
6283
|
jQuery(this).parents('.btn-group').addClass(
|
|
6272
6284
|
'hidden-xs');
|
|
6273
6285
|
});
|
|
6274
|
-
var menu =
|
|
6286
|
+
var menu = dropdown.find('.dropdown-menu');
|
|
6275
6287
|
button.click(function() {
|
|
6276
6288
|
menu.find([
|
|
6277
6289
|
'.' + menu_action[0] + '_button',
|
|
@@ -6394,12 +6406,18 @@ var Sao = {};
|
|
|
6394
6406
|
.appendTo(menu);
|
|
6395
6407
|
}.bind(this));
|
|
6396
6408
|
|
|
6409
|
+
if (menu_action[0] != 'action') {
|
|
6410
|
+
button._can_be_sensitive = Boolean(
|
|
6411
|
+
menu.children().length);
|
|
6412
|
+
}
|
|
6413
|
+
|
|
6397
6414
|
if (menu_action[0] == 'print') {
|
|
6398
6415
|
if (toolbars.exports.length && toolbars.print.length) {
|
|
6399
6416
|
menu.append(jQuery('<li/>', {
|
|
6400
6417
|
'role': 'separator',
|
|
6401
6418
|
'class': 'divider',
|
|
6402
6419
|
}));
|
|
6420
|
+
button._can_be_sensitive = true;
|
|
6403
6421
|
}
|
|
6404
6422
|
toolbars.exports.forEach(function(export_) {
|
|
6405
6423
|
var item = jQuery('<li/>', {
|
|
@@ -6448,7 +6466,13 @@ var Sao = {};
|
|
|
6448
6466
|
);
|
|
6449
6467
|
},
|
|
6450
6468
|
_close_allowed: function() {
|
|
6451
|
-
return this.modified_save()
|
|
6469
|
+
return this.modified_save().then(null, function(result) {
|
|
6470
|
+
if (result) {
|
|
6471
|
+
return jQuery.Deferred().resolve();
|
|
6472
|
+
} else {
|
|
6473
|
+
return jQuery.Deferred().reject();
|
|
6474
|
+
}
|
|
6475
|
+
});
|
|
6452
6476
|
},
|
|
6453
6477
|
modified_save: function() {
|
|
6454
6478
|
this.screen.save_tree_state();
|
|
@@ -6464,13 +6488,14 @@ var Sao = {};
|
|
|
6464
6488
|
case 'ko':
|
|
6465
6489
|
var record_id = this.screen.current_record.id;
|
|
6466
6490
|
return this.reload(false).then(function() {
|
|
6467
|
-
if (
|
|
6491
|
+
if (record_id < 0) {
|
|
6492
|
+
return jQuery.Deferred().reject(true);
|
|
6493
|
+
}
|
|
6494
|
+
else if (this.screen.current_record) {
|
|
6468
6495
|
if (record_id !=
|
|
6469
6496
|
this.screen.current_record.id) {
|
|
6470
6497
|
return jQuery.Deferred().reject();
|
|
6471
6498
|
}
|
|
6472
|
-
} else if (record_id < 0) {
|
|
6473
|
-
return jQuery.Deferred().resolve();
|
|
6474
6499
|
}
|
|
6475
6500
|
}.bind(this));
|
|
6476
6501
|
default:
|
|
@@ -6966,7 +6991,8 @@ var Sao = {};
|
|
|
6966
6991
|
resources = {};
|
|
6967
6992
|
}
|
|
6968
6993
|
var record_id = this.screen.get_id();
|
|
6969
|
-
var disabled =
|
|
6994
|
+
var disabled = (
|
|
6995
|
+
record_id < 0 || record_id === null || record_id === undefined);
|
|
6970
6996
|
|
|
6971
6997
|
var update = function(name, title, text, color) {
|
|
6972
6998
|
var button = this.buttons[name];
|
|
@@ -7022,13 +7048,25 @@ var Sao = {};
|
|
|
7022
7048
|
if (data[0] !== 0) {
|
|
7023
7049
|
name = data[0];
|
|
7024
7050
|
}
|
|
7025
|
-
var buttons = ['print', 'relate', 'attach'];
|
|
7051
|
+
var buttons = ['print', 'relate', 'email', 'save', 'attach'];
|
|
7026
7052
|
buttons.forEach(function(button_id){
|
|
7027
7053
|
var button = this.buttons[button_id];
|
|
7028
|
-
|
|
7029
|
-
|
|
7030
|
-
|
|
7054
|
+
var can_be_sensitive = button._can_be_sensitive;
|
|
7055
|
+
if (can_be_sensitive === undefined) {
|
|
7056
|
+
can_be_sensitive = true;
|
|
7057
|
+
}
|
|
7058
|
+
if ((button_id == 'print') ||
|
|
7059
|
+
(button_id == 'relate') ||
|
|
7060
|
+
(button_id == 'email')) {
|
|
7061
|
+
can_be_sensitive |= this.screen.get_buttons().some(
|
|
7062
|
+
function(button) {
|
|
7063
|
+
var keyword = button.attributes.keyword || 'action';
|
|
7064
|
+
return keyword == button_id;
|
|
7065
|
+
});
|
|
7066
|
+
} else if (button_id == 'save') {
|
|
7067
|
+
can_be_sensitive &= !this.screen.readonly;
|
|
7031
7068
|
}
|
|
7069
|
+
button.prop('disabled', !(data[0] && can_be_sensitive));
|
|
7032
7070
|
}.bind(this));
|
|
7033
7071
|
this.buttons.switch_.prop('disabled',
|
|
7034
7072
|
this.attributes.view_ids > 1);
|
|
@@ -7049,17 +7087,17 @@ var Sao = {};
|
|
|
7049
7087
|
},
|
|
7050
7088
|
action: function() {
|
|
7051
7089
|
window.setTimeout(function() {
|
|
7052
|
-
this.buttons.action.
|
|
7090
|
+
this.buttons.action.click();
|
|
7053
7091
|
}.bind(this));
|
|
7054
7092
|
},
|
|
7055
7093
|
relate: function() {
|
|
7056
7094
|
window.setTimeout(function() {
|
|
7057
|
-
this.buttons.relate.
|
|
7095
|
+
this.buttons.relate.click();
|
|
7058
7096
|
}.bind(this));
|
|
7059
7097
|
},
|
|
7060
7098
|
print: function() {
|
|
7061
7099
|
window.setTimeout(function() {
|
|
7062
|
-
this.buttons.print.
|
|
7100
|
+
this.buttons.print.click();
|
|
7063
7101
|
}.bind(this));
|
|
7064
7102
|
},
|
|
7065
7103
|
export: function(){
|
|
@@ -13706,6 +13744,15 @@ function eval_pyson(value){
|
|
|
13706
13744
|
Sao.View.Form.HTML._super.display.call(this);
|
|
13707
13745
|
this.button.attr('href', this.uri());
|
|
13708
13746
|
},
|
|
13747
|
+
set_readonly: function(readonly) {
|
|
13748
|
+
Sao.View.Form.HTML._super.set_readonly.call(this, readonly);
|
|
13749
|
+
this.el.find('button').prop('disabled', readonly);
|
|
13750
|
+
if (readonly) {
|
|
13751
|
+
this.el.find('a').hide();
|
|
13752
|
+
} else {
|
|
13753
|
+
this.el.find('a').show();
|
|
13754
|
+
}
|
|
13755
|
+
},
|
|
13709
13756
|
translate_dialog: function(languages) {
|
|
13710
13757
|
var options = {};
|
|
13711
13758
|
languages.forEach(function(language) {
|
|
@@ -15095,7 +15142,7 @@ function eval_pyson(value){
|
|
|
15095
15142
|
var inversion = new Sao.common.DomainInversion();
|
|
15096
15143
|
domain = inversion.simplify(domain);
|
|
15097
15144
|
var decoder = new Sao.PYSON.Decoder(this.screen.context);
|
|
15098
|
-
var min_width =
|
|
15145
|
+
var min_width = [];
|
|
15099
15146
|
this.columns.forEach(function(column) {
|
|
15100
15147
|
visible_columns += 1;
|
|
15101
15148
|
var name = column.attributes.name;
|
|
@@ -15140,13 +15187,13 @@ function eval_pyson(value){
|
|
|
15140
15187
|
var width, c_width;
|
|
15141
15188
|
if (column.width) {
|
|
15142
15189
|
width = c_width = column.width;
|
|
15190
|
+
min_width.push(width + 'px');
|
|
15143
15191
|
} else {
|
|
15144
15192
|
width = {
|
|
15145
|
-
'integer':
|
|
15146
|
-
'biginteger':
|
|
15147
|
-
'float': 8,
|
|
15148
|
-
'numeric': 8,
|
|
15193
|
+
'integer': 8,
|
|
15194
|
+
'biginteger': 8,
|
|
15149
15195
|
'selection': 9,
|
|
15196
|
+
'reference': 20,
|
|
15150
15197
|
'one2many': 5,
|
|
15151
15198
|
'many2many': 5,
|
|
15152
15199
|
'boolean': 3,
|
|
@@ -15160,15 +15207,14 @@ function eval_pyson(value){
|
|
|
15160
15207
|
factor += parseInt(column.attributes.expand, 10);
|
|
15161
15208
|
}
|
|
15162
15209
|
c_width = width * 100 * factor + '%';
|
|
15163
|
-
width
|
|
15210
|
+
min_width.push(width + 'em');
|
|
15164
15211
|
}
|
|
15165
15212
|
column.col.css('width', c_width);
|
|
15166
|
-
min_width += width;
|
|
15167
15213
|
column.col.show();
|
|
15168
15214
|
}
|
|
15169
15215
|
}.bind(this));
|
|
15170
|
-
this.table.css('min-width', min_width + '
|
|
15171
|
-
this.scrollbar.css('min-width',
|
|
15216
|
+
this.table.css('min-width', 'calc(' + min_width.join(' + ') + ')');
|
|
15217
|
+
this.scrollbar.css('min-width', this.table.css('min-width'));
|
|
15172
15218
|
this.tbody.find('tr.more-row > td').attr(
|
|
15173
15219
|
'colspan', visible_columns);
|
|
15174
15220
|
|
|
@@ -19480,8 +19526,7 @@ function eval_pyson(value){
|
|
|
19480
19526
|
name = name.slice(0, -9);
|
|
19481
19527
|
}
|
|
19482
19528
|
if (!(name in this.fields)) {
|
|
19483
|
-
|
|
19484
|
-
if (escaped.startsWith('%') && escaped.endsWith('%')) {
|
|
19529
|
+
if (this.is_full_text(value)) {
|
|
19485
19530
|
value = value.slice(1, -1);
|
|
19486
19531
|
}
|
|
19487
19532
|
return this.quote(value);
|
|
@@ -19492,16 +19537,15 @@ function eval_pyson(value){
|
|
|
19492
19537
|
target = clause[3];
|
|
19493
19538
|
}
|
|
19494
19539
|
if (operator.contains('ilike')) {
|
|
19495
|
-
|
|
19496
|
-
if (escaped.startsWith('%') && escaped.endsWith('%')) {
|
|
19540
|
+
if (this.is_full_text(value)) {
|
|
19497
19541
|
value = value.slice(1, -1);
|
|
19498
|
-
} else if (!
|
|
19542
|
+
} else if (!this.is_like(value)) {
|
|
19499
19543
|
if (operator == 'ilike') {
|
|
19500
19544
|
operator = '=';
|
|
19501
19545
|
} else {
|
|
19502
19546
|
operator = '!';
|
|
19503
19547
|
}
|
|
19504
|
-
value =
|
|
19548
|
+
value = this.unescape(value);
|
|
19505
19549
|
}
|
|
19506
19550
|
}
|
|
19507
19551
|
var def_operator = this.default_operator(field);
|
|
@@ -20137,6 +20181,36 @@ function eval_pyson(value){
|
|
|
20137
20181
|
return '%' + value + '%';
|
|
20138
20182
|
}
|
|
20139
20183
|
},
|
|
20184
|
+
is_full_text: function(value, escape) {
|
|
20185
|
+
escape = escape || '\\';
|
|
20186
|
+
var escaped = value;
|
|
20187
|
+
while (escaped.charAt(0) == '%') {
|
|
20188
|
+
escaped = escaped.substring(1);
|
|
20189
|
+
}
|
|
20190
|
+
while (escaped.charAt(escaped.length - 1) == '%') {
|
|
20191
|
+
escaped = escaped.substring(0, escaped.length - 1);
|
|
20192
|
+
}
|
|
20193
|
+
escaped = escaped
|
|
20194
|
+
.replace(escape + '%', '')
|
|
20195
|
+
.replace(escape + '_', '');
|
|
20196
|
+
if (escaped.contains('%') || escaped.contains('_')) {
|
|
20197
|
+
return false;
|
|
20198
|
+
}
|
|
20199
|
+
return value.startsWith('%') && value.endsWith('%');
|
|
20200
|
+
},
|
|
20201
|
+
is_like: function(value, escape) {
|
|
20202
|
+
escape = escape || '\\';
|
|
20203
|
+
var escaped = value
|
|
20204
|
+
.replace(escape + '%', '')
|
|
20205
|
+
.replace(escape + '_', '');
|
|
20206
|
+
return escaped.contains('%') || escaped.contains('_');
|
|
20207
|
+
},
|
|
20208
|
+
unescape: function(value, escape) {
|
|
20209
|
+
escape = escape || '\\';
|
|
20210
|
+
return value
|
|
20211
|
+
.replace(escape + '%', '%')
|
|
20212
|
+
.replace(escape + '_', '_');
|
|
20213
|
+
},
|
|
20140
20214
|
quote: function(value) {
|
|
20141
20215
|
if (typeof value != 'string') {
|
|
20142
20216
|
return value;
|
|
@@ -25014,6 +25088,7 @@ function eval_pyson(value){
|
|
|
25014
25088
|
|
|
25015
25089
|
this.context = context;
|
|
25016
25090
|
this.actions = [];
|
|
25091
|
+
this.containers = [];
|
|
25017
25092
|
this.state_widgets = [];
|
|
25018
25093
|
this.el = jQuery('<div/>', {
|
|
25019
25094
|
'class': 'board'
|