tryton-sao 6.0.21 → 6.0.23
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 +7 -0
- package/dist/tryton-sao.js +32 -25
- package/dist/tryton-sao.min.js +2 -2
- package/package.json +1 -1
- package/src/common.js +1 -1
- package/src/sao.js +2 -2
- package/src/tab.js +6 -9
- package/src/view/form.js +11 -8
- package/src/view/tree.js +12 -5
- package/tests/sao.js +16 -6
package/package.json
CHANGED
package/src/common.js
CHANGED
|
@@ -226,7 +226,7 @@
|
|
|
226
226
|
|
|
227
227
|
Sao.common.date_format = function(format) {
|
|
228
228
|
if (jQuery.isEmptyObject(format)) {
|
|
229
|
-
format = '%
|
|
229
|
+
format = '%x';
|
|
230
230
|
if (Sao.Session.current_session) {
|
|
231
231
|
var context = Sao.Session.current_session.context;
|
|
232
232
|
if (context.locale && context.locale.date) {
|
package/src/sao.js
CHANGED
package/src/tab.js
CHANGED
|
@@ -1668,20 +1668,17 @@
|
|
|
1668
1668
|
},
|
|
1669
1669
|
_close_allowed: function() {
|
|
1670
1670
|
var wizard = this.wizard;
|
|
1671
|
-
var prm = jQuery.when();
|
|
1672
1671
|
if ((wizard.state !== wizard.end_state) &&
|
|
1673
1672
|
(wizard.end_state in wizard.states)) {
|
|
1674
|
-
|
|
1673
|
+
wizard.response(
|
|
1675
1674
|
wizard.states[wizard.end_state].attributes);
|
|
1676
1675
|
}
|
|
1677
1676
|
var dfd = jQuery.Deferred();
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
}
|
|
1684
|
-
});
|
|
1677
|
+
if (wizard.state === wizard.end_state) {
|
|
1678
|
+
dfd.resolve();
|
|
1679
|
+
} else {
|
|
1680
|
+
dfd.reject();
|
|
1681
|
+
}
|
|
1685
1682
|
return dfd.promise();
|
|
1686
1683
|
}
|
|
1687
1684
|
});
|
package/src/view/form.js
CHANGED
|
@@ -1594,7 +1594,6 @@ function eval_pyson(value){
|
|
|
1594
1594
|
_input_format: '%Y-%m-%d',
|
|
1595
1595
|
_format: Sao.common.format_date,
|
|
1596
1596
|
_parse: Sao.common.parse_date,
|
|
1597
|
-
_default_format: '%x',
|
|
1598
1597
|
init: function(view, attributes) {
|
|
1599
1598
|
Sao.View.Form.Date._super.init.call(this, view, attributes);
|
|
1600
1599
|
this.el = jQuery('<div/>', {
|
|
@@ -1626,7 +1625,10 @@ function eval_pyson(value){
|
|
|
1626
1625
|
value = this._parse(this._input_format, value);
|
|
1627
1626
|
value = this._format(this.get_format(), value);
|
|
1628
1627
|
this.date.val(value).change();
|
|
1629
|
-
|
|
1628
|
+
if (!~navigator.userAgent.indexOf("Firefox")) {
|
|
1629
|
+
// Firefox triggers change when navigate by month/year
|
|
1630
|
+
this.date.focus();
|
|
1631
|
+
}
|
|
1630
1632
|
}
|
|
1631
1633
|
}.bind(this));
|
|
1632
1634
|
if (this.input[0].type == this._input) {
|
|
@@ -1634,6 +1636,7 @@ function eval_pyson(value){
|
|
|
1634
1636
|
'class': 'icon-input icon-secondary',
|
|
1635
1637
|
'aria-label': Sao.i18n.gettext("Open the calendar"),
|
|
1636
1638
|
'title': Sao.i18n.gettext("Open the calendar"),
|
|
1639
|
+
'tabindex': -1,
|
|
1637
1640
|
}).appendTo(group);
|
|
1638
1641
|
this.input.appendTo(this.icon);
|
|
1639
1642
|
Sao.common.ICONFACTORY.get_icon_img('tryton-date')
|
|
@@ -1673,7 +1676,8 @@ function eval_pyson(value){
|
|
|
1673
1676
|
if (this.field && this.record) {
|
|
1674
1677
|
return this.field.date_format(this.record);
|
|
1675
1678
|
} else {
|
|
1676
|
-
return
|
|
1679
|
+
return Sao.common.date_format(
|
|
1680
|
+
this.view.screen.context.date_format);
|
|
1677
1681
|
}
|
|
1678
1682
|
},
|
|
1679
1683
|
get_value: function() {
|
|
@@ -1730,13 +1734,13 @@ function eval_pyson(value){
|
|
|
1730
1734
|
_input_format: '%Y-%m-%dT%H:%M:%S',
|
|
1731
1735
|
_format: Sao.common.format_datetime,
|
|
1732
1736
|
_parse: Sao.common.parse_datetime,
|
|
1733
|
-
_default_format: '%x %X',
|
|
1734
1737
|
get_format: function() {
|
|
1735
1738
|
if (this.field && this.record) {
|
|
1736
1739
|
return (this.field.date_format(this.record) + ' ' +
|
|
1737
1740
|
this.field.time_format(this.record));
|
|
1738
1741
|
} else {
|
|
1739
|
-
return
|
|
1742
|
+
return (Sao.common.date_format(
|
|
1743
|
+
this.view.screen.context.date_format) + ' %X');
|
|
1740
1744
|
}
|
|
1741
1745
|
},
|
|
1742
1746
|
cast: function(value){
|
|
@@ -1751,7 +1755,6 @@ function eval_pyson(value){
|
|
|
1751
1755
|
_input_format: '%H:%M:%S',
|
|
1752
1756
|
_format: Sao.common.format_time,
|
|
1753
1757
|
_parse: Sao.common.parse_time,
|
|
1754
|
-
_default_format: '%X',
|
|
1755
1758
|
init: function(view, attributes) {
|
|
1756
1759
|
Sao.View.Form.Time._super.init.call(this, view, attributes);
|
|
1757
1760
|
if (~navigator.userAgent.indexOf("Firefox")) {
|
|
@@ -1763,7 +1766,7 @@ function eval_pyson(value){
|
|
|
1763
1766
|
if (this.field && this.record) {
|
|
1764
1767
|
return this.field.time_format(this.record);
|
|
1765
1768
|
} else {
|
|
1766
|
-
return
|
|
1769
|
+
return '%X';
|
|
1767
1770
|
}
|
|
1768
1771
|
},
|
|
1769
1772
|
cast: function(value){
|
|
@@ -3243,7 +3246,7 @@ function eval_pyson(value){
|
|
|
3243
3246
|
size_limit = record.expr_eval(this.attributes.size);
|
|
3244
3247
|
}
|
|
3245
3248
|
if (this._readonly) {
|
|
3246
|
-
if (size_limit === null) {
|
|
3249
|
+
if ((size_limit === null) || (size_limit === undefined)) {
|
|
3247
3250
|
size_limit = this.screen.group.length;
|
|
3248
3251
|
} else {
|
|
3249
3252
|
size_limit = Math.min(
|
package/src/view/tree.js
CHANGED
|
@@ -1213,12 +1213,19 @@
|
|
|
1213
1213
|
var redraw = function() {
|
|
1214
1214
|
for (; i < rows.length; i++) {
|
|
1215
1215
|
var row = rows[i];
|
|
1216
|
-
var record = row.record
|
|
1217
|
-
|
|
1218
|
-
|
|
1216
|
+
var record = row.record;
|
|
1217
|
+
var field_name;
|
|
1218
|
+
for (var j=0; j < row.tree.columns.length; j++) {
|
|
1219
|
+
var column = row.tree.columns[j];
|
|
1220
|
+
if (column.type == 'field') {
|
|
1221
|
+
field_name = column.attributes.name;
|
|
1222
|
+
break;
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
if (field_name && !record.is_loaded(field_name)) {
|
|
1219
1226
|
// Prefetch the first field to prevent promises in
|
|
1220
1227
|
// Cell.render
|
|
1221
|
-
record.load(
|
|
1228
|
+
record.load(field_name).done(redraw);
|
|
1222
1229
|
return;
|
|
1223
1230
|
} else {
|
|
1224
1231
|
row.redraw(selected, expanded);
|
|
@@ -1770,7 +1777,7 @@
|
|
|
1770
1777
|
|
|
1771
1778
|
var current_record = this.tree.screen.current_record;
|
|
1772
1779
|
if ((this.record != current_record) &&
|
|
1773
|
-
!current_record.validate(
|
|
1780
|
+
current_record && !current_record.validate(
|
|
1774
1781
|
this.tree.get_fields(), false, false, true)) {
|
|
1775
1782
|
return;
|
|
1776
1783
|
}
|
package/tests/sao.js
CHANGED
|
@@ -1626,22 +1626,27 @@
|
|
|
1626
1626
|
|
|
1627
1627
|
QUnit.test('DomainParser.convert_value', function() {
|
|
1628
1628
|
var parser = new Sao.common.DomainParser();
|
|
1629
|
+
var context = {
|
|
1630
|
+
'date_format': '%Y-%m-%d',
|
|
1631
|
+
};
|
|
1629
1632
|
|
|
1630
1633
|
var test_func = function(test) {
|
|
1631
1634
|
var value = test[0];
|
|
1632
1635
|
var result = test[1];
|
|
1633
|
-
QUnit.strictEqual(
|
|
1636
|
+
QUnit.strictEqual(
|
|
1637
|
+
parser.convert_value(this, value, context), result,
|
|
1634
1638
|
'convert_value(' + JSON.stringify(this) + ', ' +
|
|
1635
|
-
|
|
1639
|
+
JSON.stringify(value) + ', ' + JSON.stringify(context) + ')');
|
|
1636
1640
|
};
|
|
1637
1641
|
|
|
1638
1642
|
var test_valueOf_func = function(test) {
|
|
1639
1643
|
var value = test[0];
|
|
1640
1644
|
var result = test[1];
|
|
1641
|
-
QUnit.strictEqual(
|
|
1645
|
+
QUnit.strictEqual(
|
|
1646
|
+
parser.convert_value(this, value, context).valueOf(),
|
|
1642
1647
|
result.valueOf(),
|
|
1643
1648
|
'convert_value(' + JSON.stringify(this) + ', ' +
|
|
1644
|
-
|
|
1649
|
+
JSON.stringify(value) + ', ' + JSON.stringify(context) + ')');
|
|
1645
1650
|
};
|
|
1646
1651
|
|
|
1647
1652
|
var field = {
|
|
@@ -1915,13 +1920,18 @@
|
|
|
1915
1920
|
|
|
1916
1921
|
QUnit.test('DomainParser.format_value', function() {
|
|
1917
1922
|
var parser = new Sao.common.DomainParser();
|
|
1923
|
+
var context = {
|
|
1924
|
+
'date_format': '%Y-%m-%d',
|
|
1925
|
+
};
|
|
1918
1926
|
|
|
1919
1927
|
var test_func = function(test) {
|
|
1920
1928
|
var value = test[0];
|
|
1921
1929
|
var result = test[1];
|
|
1922
|
-
QUnit.strictEqual(
|
|
1930
|
+
QUnit.strictEqual(
|
|
1931
|
+
parser.format_value(this, value, null, context), result,
|
|
1923
1932
|
'format_value(' + JSON.stringify(this) + ', ' +
|
|
1924
|
-
|
|
1933
|
+
JSON.stringify(value) + ', null, ' + JSON.stringify(context) +
|
|
1934
|
+
')');
|
|
1925
1935
|
};
|
|
1926
1936
|
|
|
1927
1937
|
var field = {
|