tryton-sao 6.0.21 → 6.0.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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "tryton-sao",
3
3
  "title": "sao",
4
4
  "description": "Tryton webclient",
5
- "version": "6.0.21",
5
+ "version": "6.0.22",
6
6
  "homepage": "http://www.tryton.org/",
7
7
  "author": {
8
8
  "name": "Tryton"
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 = '%Y-%m-%d';
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
@@ -504,8 +504,8 @@ var Sao = {};
504
504
  }
505
505
  function open_wizard(path) {
506
506
  var attributes = {};
507
- attributes.name = path[0];
508
- if (!attributes.name) {
507
+ attributes.action = path[0];
508
+ if (!attributes.action) {
509
509
  return;
510
510
  }
511
511
  try {
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
- prm = wizard.response(
1673
+ wizard.response(
1675
1674
  wizard.states[wizard.end_state].attributes);
1676
1675
  }
1677
1676
  var dfd = jQuery.Deferred();
1678
- prm.always(function() {
1679
- if (wizard.state === wizard.end_state) {
1680
- dfd.resolve();
1681
- } else {
1682
- dfd.reject();
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/>', {
@@ -1673,7 +1672,8 @@ function eval_pyson(value){
1673
1672
  if (this.field && this.record) {
1674
1673
  return this.field.date_format(this.record);
1675
1674
  } else {
1676
- return this._default_format;
1675
+ return Sao.common.date_format(
1676
+ this.view.screen.context.date_format);
1677
1677
  }
1678
1678
  },
1679
1679
  get_value: function() {
@@ -1730,13 +1730,13 @@ function eval_pyson(value){
1730
1730
  _input_format: '%Y-%m-%dT%H:%M:%S',
1731
1731
  _format: Sao.common.format_datetime,
1732
1732
  _parse: Sao.common.parse_datetime,
1733
- _default_format: '%x %X',
1734
1733
  get_format: function() {
1735
1734
  if (this.field && this.record) {
1736
1735
  return (this.field.date_format(this.record) + ' ' +
1737
1736
  this.field.time_format(this.record));
1738
1737
  } else {
1739
- return this._default_format;
1738
+ return (Sao.common.date_format(
1739
+ this.view.screen.context.date_format) + ' %X');
1740
1740
  }
1741
1741
  },
1742
1742
  cast: function(value){
@@ -1751,7 +1751,6 @@ function eval_pyson(value){
1751
1751
  _input_format: '%H:%M:%S',
1752
1752
  _format: Sao.common.format_time,
1753
1753
  _parse: Sao.common.parse_time,
1754
- _default_format: '%X',
1755
1754
  init: function(view, attributes) {
1756
1755
  Sao.View.Form.Time._super.init.call(this, view, attributes);
1757
1756
  if (~navigator.userAgent.indexOf("Firefox")) {
@@ -1763,7 +1762,7 @@ function eval_pyson(value){
1763
1762
  if (this.field && this.record) {
1764
1763
  return this.field.time_format(this.record);
1765
1764
  } else {
1766
- return this._default_format;
1765
+ return '%X';
1767
1766
  }
1768
1767
  },
1769
1768
  cast: function(value){
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(parser.convert_value(this, value), result,
1636
+ QUnit.strictEqual(
1637
+ parser.convert_value(this, value, context), result,
1634
1638
  'convert_value(' + JSON.stringify(this) + ', ' +
1635
- JSON.stringify(value) + ')');
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(parser.convert_value(this, value).valueOf(),
1645
+ QUnit.strictEqual(
1646
+ parser.convert_value(this, value, context).valueOf(),
1642
1647
  result.valueOf(),
1643
1648
  'convert_value(' + JSON.stringify(this) + ', ' +
1644
- JSON.stringify(value) + ')');
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(parser.format_value(this, value), result,
1930
+ QUnit.strictEqual(
1931
+ parser.format_value(this, value, null, context), result,
1923
1932
  'format_value(' + JSON.stringify(this) + ', ' +
1924
- JSON.stringify(value) + ')');
1933
+ JSON.stringify(value) + ', null, ' + JSON.stringify(context) +
1934
+ ')');
1925
1935
  };
1926
1936
 
1927
1937
  var field = {