tryton-sao 7.2.21 → 7.2.22
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 +5 -0
- package/dist/tryton-sao.js +30 -24
- package/package.json +1 -1
- package/src/common.js +11 -8
- package/src/model.js +16 -14
- package/src/sao.js +3 -2
package/CHANGELOG
CHANGED
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.22',
|
|
7
7
|
};
|
|
8
8
|
/* eslint-enable no-redeclare */
|
|
9
9
|
|
|
@@ -660,6 +660,7 @@ var Sao = {
|
|
|
660
660
|
"Incompatible version of the server."),
|
|
661
661
|
Sao.i18n.gettext("Version mismatch"));
|
|
662
662
|
} else {
|
|
663
|
+
let url = window.location.hash.substr(1);
|
|
663
664
|
Sao.Session.get_credentials()
|
|
664
665
|
.then(function(session) {
|
|
665
666
|
Sao.Session.current_session = session;
|
|
@@ -669,7 +670,7 @@ var Sao = {
|
|
|
669
670
|
.then(function(preferences) {
|
|
670
671
|
Sao.menu(preferences);
|
|
671
672
|
Sao.user_menu(preferences);
|
|
672
|
-
Sao.open_url();
|
|
673
|
+
Sao.open_url(url);
|
|
673
674
|
Sao.Bus.listen();
|
|
674
675
|
});
|
|
675
676
|
}
|
|
@@ -7656,16 +7657,19 @@ var Sao = {
|
|
|
7656
7657
|
return null;
|
|
7657
7658
|
}
|
|
7658
7659
|
var type = '';
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
|
|
7664
|
-
|
|
7660
|
+
var xml = data;
|
|
7661
|
+
if (xml instanceof Uint8Array) {
|
|
7662
|
+
xml = new TextDecoder().decode(data);
|
|
7663
|
+
}
|
|
7664
|
+
// simple test to avoid logging of parsing error
|
|
7665
|
+
if (/^\s*<[\s\S]+>\s*$/.test(xml.trim())) {
|
|
7666
|
+
let parser = new DOMParser();
|
|
7667
|
+
let doc = parser.parseFromString(xml, 'image/svg+xml');
|
|
7668
|
+
if (!doc.querySelector('parsererror')
|
|
7669
|
+
&& (doc.documentElement.tagName.toLowerCase() === 'svg' ||
|
|
7670
|
+
doc.getElementsByTagName('svg').length > 0)) {
|
|
7665
7671
|
type = 'image/svg+xml';
|
|
7666
7672
|
}
|
|
7667
|
-
} catch (e) {
|
|
7668
|
-
// continue
|
|
7669
7673
|
}
|
|
7670
7674
|
var blob = new Blob([data], {type: type});
|
|
7671
7675
|
return window.URL.createObjectURL(blob);
|
|
@@ -9462,7 +9466,6 @@ var Sao = {
|
|
|
9462
9466
|
// XXX to remove once server domains are fixed
|
|
9463
9467
|
value = null;
|
|
9464
9468
|
}
|
|
9465
|
-
var setdefault = true;
|
|
9466
9469
|
var original_domain;
|
|
9467
9470
|
if (!jQuery.isEmptyObject(record.group.domain)) {
|
|
9468
9471
|
original_domain = inversion.merge(record.group.domain);
|
|
@@ -9470,20 +9473,12 @@ var Sao = {
|
|
|
9470
9473
|
original_domain = inversion.merge(domain);
|
|
9471
9474
|
}
|
|
9472
9475
|
var domain_readonly = original_domain[0] == 'AND';
|
|
9476
|
+
let setdefault;
|
|
9473
9477
|
if (leftpart.contains('.')) {
|
|
9474
|
-
|
|
9475
|
-
|
|
9476
|
-
|
|
9477
|
-
|
|
9478
|
-
for (const leaf of inversion.localize_domain(
|
|
9479
|
-
original_domain.slice(1))) {
|
|
9480
|
-
constraintfields.push(leaf);
|
|
9481
|
-
}
|
|
9482
|
-
}
|
|
9483
|
-
if ((localpart != 'id') ||
|
|
9484
|
-
!~constraintfields.indexOf(recordpart)) {
|
|
9485
|
-
setdefault = false;
|
|
9486
|
-
}
|
|
9478
|
+
let localpart = leftpart.split('.').slice(1).join('.');
|
|
9479
|
+
setdefault = localpart == 'id';
|
|
9480
|
+
} else {
|
|
9481
|
+
setdefault = true;
|
|
9487
9482
|
}
|
|
9488
9483
|
if (setdefault && jQuery.isEmptyObject(pre_validate)) {
|
|
9489
9484
|
this.set_client(record, value);
|
|
@@ -9747,12 +9742,23 @@ var Sao = {
|
|
|
9747
9742
|
},
|
|
9748
9743
|
apply_factor: function(record, value, factor) {
|
|
9749
9744
|
if (value !== null) {
|
|
9745
|
+
// The default precision is the one used by value (before
|
|
9746
|
+
// applying the factor), per the ecmascript specification
|
|
9747
|
+
// it's the shortest representation of said value.
|
|
9748
|
+
// Once the factor is applied the number might become even
|
|
9749
|
+
// more inexact thus we should rely on the initial
|
|
9750
|
+
// precision + the effect factor will have
|
|
9751
|
+
// https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-numeric-types-number-tostring
|
|
9752
|
+
let default_precision = (value.toString().split('.')[1] || '').length;
|
|
9753
|
+
default_precision += Math.ceil(Math.log10(factor));
|
|
9750
9754
|
value /= factor;
|
|
9751
9755
|
var digits = this.digits(record);
|
|
9752
9756
|
if (digits) {
|
|
9753
9757
|
// Round to avoid float precision error
|
|
9754
9758
|
// after the division by factor
|
|
9755
9759
|
value = value.toFixed(digits[1]);
|
|
9760
|
+
} else {
|
|
9761
|
+
value = value.toFixed(default_precision);
|
|
9756
9762
|
}
|
|
9757
9763
|
value = this.convert(value);
|
|
9758
9764
|
}
|
package/package.json
CHANGED
package/src/common.js
CHANGED
|
@@ -4360,16 +4360,19 @@
|
|
|
4360
4360
|
return null;
|
|
4361
4361
|
}
|
|
4362
4362
|
var type = '';
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4363
|
+
var xml = data;
|
|
4364
|
+
if (xml instanceof Uint8Array) {
|
|
4365
|
+
xml = new TextDecoder().decode(data);
|
|
4366
|
+
}
|
|
4367
|
+
// simple test to avoid logging of parsing error
|
|
4368
|
+
if (/^\s*<[\s\S]+>\s*$/.test(xml.trim())) {
|
|
4369
|
+
let parser = new DOMParser();
|
|
4370
|
+
let doc = parser.parseFromString(xml, 'image/svg+xml');
|
|
4371
|
+
if (!doc.querySelector('parsererror')
|
|
4372
|
+
&& (doc.documentElement.tagName.toLowerCase() === 'svg' ||
|
|
4373
|
+
doc.getElementsByTagName('svg').length > 0)) {
|
|
4369
4374
|
type = 'image/svg+xml';
|
|
4370
4375
|
}
|
|
4371
|
-
} catch (e) {
|
|
4372
|
-
// continue
|
|
4373
4376
|
}
|
|
4374
4377
|
var blob = new Blob([data], {type: type});
|
|
4375
4378
|
return window.URL.createObjectURL(blob);
|
package/src/model.js
CHANGED
|
@@ -1781,7 +1781,6 @@
|
|
|
1781
1781
|
// XXX to remove once server domains are fixed
|
|
1782
1782
|
value = null;
|
|
1783
1783
|
}
|
|
1784
|
-
var setdefault = true;
|
|
1785
1784
|
var original_domain;
|
|
1786
1785
|
if (!jQuery.isEmptyObject(record.group.domain)) {
|
|
1787
1786
|
original_domain = inversion.merge(record.group.domain);
|
|
@@ -1789,20 +1788,12 @@
|
|
|
1789
1788
|
original_domain = inversion.merge(domain);
|
|
1790
1789
|
}
|
|
1791
1790
|
var domain_readonly = original_domain[0] == 'AND';
|
|
1791
|
+
let setdefault;
|
|
1792
1792
|
if (leftpart.contains('.')) {
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
for (const leaf of inversion.localize_domain(
|
|
1798
|
-
original_domain.slice(1))) {
|
|
1799
|
-
constraintfields.push(leaf);
|
|
1800
|
-
}
|
|
1801
|
-
}
|
|
1802
|
-
if ((localpart != 'id') ||
|
|
1803
|
-
!~constraintfields.indexOf(recordpart)) {
|
|
1804
|
-
setdefault = false;
|
|
1805
|
-
}
|
|
1793
|
+
let localpart = leftpart.split('.').slice(1).join('.');
|
|
1794
|
+
setdefault = localpart == 'id';
|
|
1795
|
+
} else {
|
|
1796
|
+
setdefault = true;
|
|
1806
1797
|
}
|
|
1807
1798
|
if (setdefault && jQuery.isEmptyObject(pre_validate)) {
|
|
1808
1799
|
this.set_client(record, value);
|
|
@@ -2066,12 +2057,23 @@
|
|
|
2066
2057
|
},
|
|
2067
2058
|
apply_factor: function(record, value, factor) {
|
|
2068
2059
|
if (value !== null) {
|
|
2060
|
+
// The default precision is the one used by value (before
|
|
2061
|
+
// applying the factor), per the ecmascript specification
|
|
2062
|
+
// it's the shortest representation of said value.
|
|
2063
|
+
// Once the factor is applied the number might become even
|
|
2064
|
+
// more inexact thus we should rely on the initial
|
|
2065
|
+
// precision + the effect factor will have
|
|
2066
|
+
// https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#sec-numeric-types-number-tostring
|
|
2067
|
+
let default_precision = (value.toString().split('.')[1] || '').length;
|
|
2068
|
+
default_precision += Math.ceil(Math.log10(factor));
|
|
2069
2069
|
value /= factor;
|
|
2070
2070
|
var digits = this.digits(record);
|
|
2071
2071
|
if (digits) {
|
|
2072
2072
|
// Round to avoid float precision error
|
|
2073
2073
|
// after the division by factor
|
|
2074
2074
|
value = value.toFixed(digits[1]);
|
|
2075
|
+
} else {
|
|
2076
|
+
value = value.toFixed(default_precision);
|
|
2075
2077
|
}
|
|
2076
2078
|
value = this.convert(value);
|
|
2077
2079
|
}
|
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.22',
|
|
7
7
|
};
|
|
8
8
|
/* eslint-enable no-redeclare */
|
|
9
9
|
|
|
@@ -660,6 +660,7 @@ var Sao = {
|
|
|
660
660
|
"Incompatible version of the server."),
|
|
661
661
|
Sao.i18n.gettext("Version mismatch"));
|
|
662
662
|
} else {
|
|
663
|
+
let url = window.location.hash.substr(1);
|
|
663
664
|
Sao.Session.get_credentials()
|
|
664
665
|
.then(function(session) {
|
|
665
666
|
Sao.Session.current_session = session;
|
|
@@ -669,7 +670,7 @@ var Sao = {
|
|
|
669
670
|
.then(function(preferences) {
|
|
670
671
|
Sao.menu(preferences);
|
|
671
672
|
Sao.user_menu(preferences);
|
|
672
|
-
Sao.open_url();
|
|
673
|
+
Sao.open_url(url);
|
|
673
674
|
Sao.Bus.listen();
|
|
674
675
|
});
|
|
675
676
|
}
|