tryton-sao 7.0.2 → 7.0.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 +2 -1
- package/dist/tryton-sao.js +65 -38
- package/dist/tryton-sao.min.css +2 -1
- package/dist/tryton-sao.min.js +2 -2
- package/package.json +1 -1
- package/src/common.js +19 -16
- package/src/model.js +13 -4
- package/src/sao.js +1 -1
- package/src/sao.less +2 -1
- package/src/screen.js +1 -2
- package/src/tab.js +16 -10
- package/src/view/form.js +11 -3
- package/src/view/tree.js +4 -2
- package/tests/sao.js +4 -1
package/CHANGELOG
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
|
|
2
|
+
Version 7.0.4 - 2024-01-01
|
|
3
|
+
--------------------------
|
|
4
|
+
* Bug fixes (see mercurial logs for details)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Version 7.0.3 - 2023-12-16
|
|
8
|
+
--------------------------
|
|
9
|
+
* Bug fixes (see mercurial logs for details)
|
|
10
|
+
|
|
11
|
+
|
|
2
12
|
Version 7.0.2 - 2023-12-01
|
|
3
13
|
--------------------------
|
|
4
14
|
* Bug fixes (see mercurial logs for details)
|
package/dist/tryton-sao.css
CHANGED
|
@@ -10229,7 +10229,8 @@ input.column-boolean {
|
|
|
10229
10229
|
}
|
|
10230
10230
|
.xalign-center,
|
|
10231
10231
|
.xalign-end {
|
|
10232
|
-
|
|
10232
|
+
justify-self: start;
|
|
10233
|
+
justify-content: start;
|
|
10233
10234
|
}
|
|
10234
10235
|
}
|
|
10235
10236
|
@media screen and (max-width: 767px) {
|
package/dist/tryton-sao.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* This file is part of Tryton. The COPYRIGHT file at the top level of
|
|
2
2
|
this repository contains the full copyright notices and license terms. */
|
|
3
3
|
var Sao = {
|
|
4
|
-
__version__: '7.0.
|
|
4
|
+
__version__: '7.0.4',
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
(function() {
|
|
@@ -3256,12 +3256,14 @@ var Sao = {
|
|
|
3256
3256
|
|
|
3257
3257
|
Sao.common.scrollIntoViewIfNeeded = function(element) {
|
|
3258
3258
|
element = element[0];
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3259
|
+
if (element) {
|
|
3260
|
+
var rect = element.getBoundingClientRect();
|
|
3261
|
+
if (rect.bottom > window.innerHeight) {
|
|
3262
|
+
element.scrollIntoView(false);
|
|
3263
|
+
}
|
|
3264
|
+
if (rect.top < 0) {
|
|
3265
|
+
element.scrollIntoView();
|
|
3266
|
+
}
|
|
3265
3267
|
}
|
|
3266
3268
|
};
|
|
3267
3269
|
|
|
@@ -3987,8 +3989,12 @@ var Sao = {
|
|
|
3987
3989
|
}
|
|
3988
3990
|
});
|
|
3989
3991
|
prm.fail(() => {
|
|
3992
|
+
var selection = [];
|
|
3993
|
+
if (this.nullable_widget) {
|
|
3994
|
+
selection.push([null, '']);
|
|
3995
|
+
}
|
|
3990
3996
|
this._last_domain = null;
|
|
3991
|
-
this.selection =
|
|
3997
|
+
this.selection = selection;
|
|
3992
3998
|
if (callback) {
|
|
3993
3999
|
callback(this.selection, this.help);
|
|
3994
4000
|
}
|
|
@@ -4034,6 +4040,9 @@ var Sao = {
|
|
|
4034
4040
|
if (!this.attributes.relation) {
|
|
4035
4041
|
return jQuery.when([]);
|
|
4036
4042
|
}
|
|
4043
|
+
if (value === null) {
|
|
4044
|
+
return jQuery.when([null, '']);
|
|
4045
|
+
}
|
|
4037
4046
|
for (var i = 0, len = this.inactive_selection.length; i < len; i++) {
|
|
4038
4047
|
if (value == this.inactive_selection[i][0]) {
|
|
4039
4048
|
return jQuery.when(this.inactive_selection[i]);
|
|
@@ -4106,9 +4115,7 @@ var Sao = {
|
|
|
4106
4115
|
} else {
|
|
4107
4116
|
this.el.show();
|
|
4108
4117
|
}
|
|
4109
|
-
this.el.prop(
|
|
4110
|
-
'disabled',
|
|
4111
|
-
(record? record.readonly : false) || Boolean(states.readonly));
|
|
4118
|
+
this.el.prop('disabled', Boolean(states.readonly));
|
|
4112
4119
|
this.set_icon(states.icon || this.attributes.icon);
|
|
4113
4120
|
|
|
4114
4121
|
if (this.attributes.rule) {
|
|
@@ -5612,10 +5619,6 @@ var Sao = {
|
|
|
5612
5619
|
if (!domain.length) {
|
|
5613
5620
|
return [0, domain];
|
|
5614
5621
|
} else if (this.is_leaf(domain)) {
|
|
5615
|
-
if (domain[2] === null) {
|
|
5616
|
-
domain = domain.slice();
|
|
5617
|
-
domain[2] = Number.NEGATIVE_INFINITY;
|
|
5618
|
-
}
|
|
5619
5622
|
return [1, domain];
|
|
5620
5623
|
} else if (~['AND', 'OR'].indexOf(domain)) {
|
|
5621
5624
|
return [0, domain];
|
|
@@ -5927,12 +5930,12 @@ var Sao = {
|
|
|
5927
5930
|
}
|
|
5928
5931
|
return this.simplify(this.merge(result));
|
|
5929
5932
|
},
|
|
5930
|
-
unique_value: function(domain) {
|
|
5933
|
+
unique_value: function(domain, single_value=true) {
|
|
5931
5934
|
if ((domain instanceof Array) &&
|
|
5932
5935
|
(domain.length == 1)) {
|
|
5933
5936
|
let [name, operator, value, ...model] = domain[0];
|
|
5934
5937
|
if (operator == '=' ||
|
|
5935
|
-
(operator == 'in' && value.length == 1)) {
|
|
5938
|
+
(single_value && operator == 'in' && value.length == 1)) {
|
|
5936
5939
|
value = operator == '=' ? value : value[0];
|
|
5937
5940
|
var count = 0;
|
|
5938
5941
|
if (model.length && name.endsWith('.id')) {
|
|
@@ -8375,6 +8378,7 @@ var Sao = {
|
|
|
8375
8378
|
}
|
|
8376
8379
|
if (this.model.fields[name] instanceof Sao.field.One2Many) {
|
|
8377
8380
|
later[name] = value;
|
|
8381
|
+
continue;
|
|
8378
8382
|
}
|
|
8379
8383
|
const field = this.model.fields[name];
|
|
8380
8384
|
var related;
|
|
@@ -8399,6 +8403,7 @@ var Sao = {
|
|
|
8399
8403
|
value = later[name];
|
|
8400
8404
|
this.model.fields[name].set(this, value);
|
|
8401
8405
|
this._loaded[name] = true;
|
|
8406
|
+
fieldnames.push(name);
|
|
8402
8407
|
}
|
|
8403
8408
|
if (validate) {
|
|
8404
8409
|
this.validate(fieldnames, true, false, false);
|
|
@@ -8665,7 +8670,8 @@ var Sao = {
|
|
|
8665
8670
|
}
|
|
8666
8671
|
fieldnames[fieldname] = true;
|
|
8667
8672
|
values = jQuery.extend(values,
|
|
8668
|
-
|
|
8673
|
+
this._get_on_change_args(
|
|
8674
|
+
on_change_with.concat([fieldname])));
|
|
8669
8675
|
if ((this.model.fields[fieldname] instanceof
|
|
8670
8676
|
Sao.field.Many2One) ||
|
|
8671
8677
|
(this.model.fields[fieldname] instanceof
|
|
@@ -8704,7 +8710,8 @@ var Sao = {
|
|
|
8704
8710
|
.description.on_change_with;
|
|
8705
8711
|
values = jQuery.extend(
|
|
8706
8712
|
values,
|
|
8707
|
-
this._get_on_change_args(
|
|
8713
|
+
this._get_on_change_args(
|
|
8714
|
+
on_change_with.concat([fieldname])));
|
|
8708
8715
|
}
|
|
8709
8716
|
fieldnames = Object.keys(later);
|
|
8710
8717
|
try {
|
|
@@ -9095,6 +9102,7 @@ var Sao = {
|
|
|
9095
9102
|
|
|
9096
9103
|
Sao.field.Field = Sao.class_(Object, {
|
|
9097
9104
|
_default: null,
|
|
9105
|
+
_single_value: true,
|
|
9098
9106
|
init: function(description) {
|
|
9099
9107
|
this.description = description;
|
|
9100
9108
|
this.name = description.name;
|
|
@@ -9267,12 +9275,13 @@ var Sao = {
|
|
|
9267
9275
|
} else {
|
|
9268
9276
|
let [screen_domain, _] = this.get_domains(
|
|
9269
9277
|
record, pre_validate);
|
|
9270
|
-
var uniques = inversion.unique_value(
|
|
9278
|
+
var uniques = inversion.unique_value(
|
|
9279
|
+
domain, this._single_value);
|
|
9271
9280
|
var unique = uniques[0];
|
|
9272
9281
|
var leftpart = uniques[1];
|
|
9273
9282
|
var value = uniques[2];
|
|
9274
9283
|
let unique_from_screen = inversion.unique_value(
|
|
9275
|
-
screen_domain)[0];
|
|
9284
|
+
screen_domain, this._single_value)[0];
|
|
9276
9285
|
if (this._is_empty(record) &&
|
|
9277
9286
|
!is_required &&
|
|
9278
9287
|
!is_invisible &&
|
|
@@ -9360,6 +9369,7 @@ var Sao = {
|
|
|
9360
9369
|
|
|
9361
9370
|
Sao.field.MultiSelection = Sao.class_(Sao.field.Selection, {
|
|
9362
9371
|
_default: null,
|
|
9372
|
+
_single_value: false,
|
|
9363
9373
|
get: function(record) {
|
|
9364
9374
|
var value = Sao.field.MultiSelection._super.get.call(this, record);
|
|
9365
9375
|
if (jQuery.isEmptyObject(value)) {
|
|
@@ -9742,6 +9752,7 @@ var Sao = {
|
|
|
9742
9752
|
Sao.field.One2Many._super.init.call(this, description);
|
|
9743
9753
|
},
|
|
9744
9754
|
_default: null,
|
|
9755
|
+
_single_value: false,
|
|
9745
9756
|
_set_value: function(record, value, default_, modified) {
|
|
9746
9757
|
this._set_default_value(record);
|
|
9747
9758
|
var group = record._values[this.name];
|
|
@@ -10352,6 +10363,7 @@ var Sao = {
|
|
|
10352
10363
|
|
|
10353
10364
|
Sao.field.Dict = Sao.class_(Sao.field.Field, {
|
|
10354
10365
|
_default: {},
|
|
10366
|
+
_single_value: false,
|
|
10355
10367
|
init: function(description) {
|
|
10356
10368
|
Sao.field.Dict._super.init.call(this, description);
|
|
10357
10369
|
this.schema_model = new Sao.Model(description.schema_model);
|
|
@@ -10763,8 +10775,9 @@ var Sao = {
|
|
|
10763
10775
|
return toolbar;
|
|
10764
10776
|
},
|
|
10765
10777
|
show: function() {
|
|
10766
|
-
|
|
10767
|
-
|
|
10778
|
+
Sao.common.scrollIntoViewIfNeeded(
|
|
10779
|
+
jQuery('#tablist').find('a[href="#' + this.id + '"]')
|
|
10780
|
+
.tab('show'));
|
|
10768
10781
|
},
|
|
10769
10782
|
close: function() {
|
|
10770
10783
|
var tabs = jQuery('#tabs');
|
|
@@ -10849,8 +10862,8 @@ var Sao = {
|
|
|
10849
10862
|
}
|
|
10850
10863
|
for (const other of Sao.Tab.tabs) {
|
|
10851
10864
|
if (other.compare(attributes)) {
|
|
10852
|
-
|
|
10853
|
-
.
|
|
10865
|
+
Sao.common.scrollIntoViewIfNeeded(
|
|
10866
|
+
tablist.find('a[href="#' + other.id + '"]').tab('show'));
|
|
10854
10867
|
return;
|
|
10855
10868
|
}
|
|
10856
10869
|
}
|
|
@@ -10907,7 +10920,7 @@ var Sao = {
|
|
|
10907
10920
|
tab_link.on('shown.bs.tab', function(evt) {
|
|
10908
10921
|
tabs.scrollTop(jQuery(evt.target).data('scrollTop') || 0);
|
|
10909
10922
|
});
|
|
10910
|
-
tab_link.tab('show')
|
|
10923
|
+
Sao.common.scrollIntoViewIfNeeded(tab_link.tab('show'));
|
|
10911
10924
|
tabs.trigger('ready');
|
|
10912
10925
|
};
|
|
10913
10926
|
|
|
@@ -11507,7 +11520,6 @@ var Sao = {
|
|
|
11507
11520
|
['delete_', access.delete],
|
|
11508
11521
|
['copy', access.create],
|
|
11509
11522
|
['import', access.create],
|
|
11510
|
-
['action', access.write && !this.screen.readonly],
|
|
11511
11523
|
]);
|
|
11512
11524
|
for (const [name, access] of accesses) {
|
|
11513
11525
|
if (this.buttons[name]) {
|
|
@@ -11520,7 +11532,7 @@ var Sao = {
|
|
|
11520
11532
|
}
|
|
11521
11533
|
} else {
|
|
11522
11534
|
for (const name of [
|
|
11523
|
-
'new_', 'save', 'delete_', 'copy', 'import'
|
|
11535
|
+
'new_', 'save', 'delete_', 'copy', 'import']) {
|
|
11524
11536
|
if (this.buttons[name]) {
|
|
11525
11537
|
this.buttons[name].prop('disabled', true);
|
|
11526
11538
|
}
|
|
@@ -11754,8 +11766,8 @@ var Sao = {
|
|
|
11754
11766
|
preview.record_message = function(position, length) {
|
|
11755
11767
|
var text = (position || '_') + '/' + length;
|
|
11756
11768
|
label.text(text).attr('title', text);
|
|
11757
|
-
but_prev.prop('disabled', !
|
|
11758
|
-
but_next.prop('disabled', !
|
|
11769
|
+
but_prev.prop('disabled', !screen.has_previous());
|
|
11770
|
+
but_next.prop('disabled', !screen.has_next());
|
|
11759
11771
|
};
|
|
11760
11772
|
screen.windows.push(preview);
|
|
11761
11773
|
|
|
@@ -11780,7 +11792,13 @@ var Sao = {
|
|
|
11780
11792
|
if (!Sao.common.compare(this.attachment_screen.domain, domain) ||
|
|
11781
11793
|
force) {
|
|
11782
11794
|
this.attachment_screen.domain = domain;
|
|
11783
|
-
this.attachment_screen.search_filter()
|
|
11795
|
+
this.attachment_screen.search_filter().then(() => {
|
|
11796
|
+
const group = this.attachment_screen.group;
|
|
11797
|
+
if (group.length) {
|
|
11798
|
+
this.attachment_screen.current_record = group[0];
|
|
11799
|
+
this.attachment_screen.display();
|
|
11800
|
+
}
|
|
11801
|
+
});
|
|
11784
11802
|
}
|
|
11785
11803
|
},
|
|
11786
11804
|
note: function() {
|
|
@@ -14049,8 +14067,7 @@ var Sao = {
|
|
|
14049
14067
|
var buttons = this.current_view.get_buttons();
|
|
14050
14068
|
for (const record of selected_records) {
|
|
14051
14069
|
buttons = buttons.filter(function(button) {
|
|
14052
|
-
if (
|
|
14053
|
-
button.attributes.type === 'instance') {
|
|
14070
|
+
if (button.attributes.type === 'instance') {
|
|
14054
14071
|
return false;
|
|
14055
14072
|
}
|
|
14056
14073
|
var states = record.expr_eval(
|
|
@@ -18640,8 +18657,12 @@ function eval_pyson(value){
|
|
|
18640
18657
|
const callback = result => {
|
|
18641
18658
|
if (result) {
|
|
18642
18659
|
screen.current_record.save().done(() => {
|
|
18660
|
+
var added = 'id' in this.screen.current_record.modified_fields;
|
|
18643
18661
|
// Force a reload on next display
|
|
18644
18662
|
this.screen.current_record.cancel();
|
|
18663
|
+
if (added) {
|
|
18664
|
+
this.screen.current_record.modified_fields.id = true;
|
|
18665
|
+
}
|
|
18645
18666
|
});
|
|
18646
18667
|
}
|
|
18647
18668
|
};
|
|
@@ -19101,12 +19122,16 @@ function eval_pyson(value){
|
|
|
19101
19122
|
});
|
|
19102
19123
|
url = window.URL.createObjectURL(blob);
|
|
19103
19124
|
}
|
|
19125
|
+
// duplicate object to force refresh on buggy browsers
|
|
19126
|
+
const object = this.object.clone();
|
|
19104
19127
|
// set onload before data to be always called
|
|
19105
|
-
|
|
19128
|
+
object.get(0).onload = function() {
|
|
19106
19129
|
this.onload = null;
|
|
19107
19130
|
window.URL.revokeObjectURL(url);
|
|
19108
19131
|
};
|
|
19109
|
-
|
|
19132
|
+
object.attr('data', url);
|
|
19133
|
+
this.object.replaceWith(object);
|
|
19134
|
+
this.object = object;
|
|
19110
19135
|
});
|
|
19111
19136
|
},
|
|
19112
19137
|
});
|
|
@@ -19155,7 +19180,7 @@ function eval_pyson(value){
|
|
|
19155
19180
|
},
|
|
19156
19181
|
set_url: function(value) {
|
|
19157
19182
|
this.button.attr('href', value);
|
|
19158
|
-
this.button.
|
|
19183
|
+
this.button.toggle(value);
|
|
19159
19184
|
},
|
|
19160
19185
|
set_invisible: function(invisible) {
|
|
19161
19186
|
Sao.View.Form.URL._super.set_invisible.call(this, invisible);
|
|
@@ -20915,12 +20940,14 @@ function eval_pyson(value){
|
|
|
20915
20940
|
} else if (name === this.screen.exclude_field) {
|
|
20916
20941
|
visible_columns -= 1;
|
|
20917
20942
|
column.set_visible(false);
|
|
20918
|
-
} else {
|
|
20943
|
+
} else if (name in this.screen.model.fields) {
|
|
20944
|
+
const field = this.screen.model.fields[name];
|
|
20919
20945
|
var inv_domain = inversion.domain_inversion(domain, name);
|
|
20920
20946
|
if (typeof inv_domain != 'boolean') {
|
|
20921
20947
|
inv_domain = inversion.simplify(inv_domain);
|
|
20922
20948
|
}
|
|
20923
|
-
var unique = inversion.unique_value(
|
|
20949
|
+
var unique = inversion.unique_value(
|
|
20950
|
+
inv_domain, field._single_value)[0];
|
|
20924
20951
|
if (unique && jQuery.isEmptyObject(this.children_field)) {
|
|
20925
20952
|
visible_columns -= 1;
|
|
20926
20953
|
column.set_visible(false);
|
package/dist/tryton-sao.min.css
CHANGED
|
@@ -10229,7 +10229,8 @@ input.column-boolean {
|
|
|
10229
10229
|
}
|
|
10230
10230
|
.xalign-center,
|
|
10231
10231
|
.xalign-end {
|
|
10232
|
-
|
|
10232
|
+
justify-self: start;
|
|
10233
|
+
justify-content: start;
|
|
10233
10234
|
}
|
|
10234
10235
|
}
|
|
10235
10236
|
@media screen and (max-width: 767px) {
|