tryton-sao 6.2.4 → 6.2.7

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.2.4",
5
+ "version": "6.2.7",
6
6
  "homepage": "http://www.tryton.org/",
7
7
  "author": {
8
8
  "name": "Tryton"
package/src/common.js CHANGED
@@ -3205,8 +3205,8 @@
3205
3205
  dialog.body.append(jQuery('<div/>', {
3206
3206
  'class': 'checkbox',
3207
3207
  }).append(jQuery('<label/>')
3208
- .append(always)
3209
- .text(Sao.i18n.gettext('Always ignore this warning.')))
3208
+ .text(Sao.i18n.gettext("Always ignore this warning."))
3209
+ .prepend(always))
3210
3210
  );
3211
3211
  dialog.body.append(jQuery('<p/>')
3212
3212
  .text(Sao.i18n.gettext('Do you want to proceed?')));
package/src/model.js CHANGED
@@ -665,7 +665,7 @@
665
665
  return;
666
666
  }
667
667
  }
668
- if (this.group.prm.state() == 'pending') {
668
+ if (async && this.group.prm.state() == 'pending') {
669
669
  return this.group.prm.then(function() {
670
670
  return this.load(name);
671
671
  }.bind(this));
@@ -2067,27 +2067,16 @@
2067
2067
  set: function(record, value) {
2068
2068
  var rec_name = (
2069
2069
  record._values[this.name + '.'] || {}).rec_name || '';
2070
- var store_rec_name = function(rec_name) {
2071
- Sao.setdefault(
2072
- record._values, this.name + '.', {})
2073
- .rec_name = rec_name[0].rec_name;
2074
- };
2075
2070
  if (!rec_name && (value >= 0) && (value !== null)) {
2076
2071
  var model_name = record.model.fields[this.name].description
2077
2072
  .relation;
2078
- Sao.rpc({
2073
+ rec_name = Sao.rpc({
2079
2074
  'method': 'model.' + model_name + '.read',
2080
2075
  'params': [[value], ['rec_name'], record.get_context()]
2081
- }, record.model.session).done(store_rec_name.bind(this)).done(
2082
- function() {
2083
- record.group.root_group.screens.forEach(
2084
- function(screen) {
2085
- screen.display();
2086
- });
2087
- });
2088
- } else {
2089
- store_rec_name.call(this, [{'rec_name': rec_name}]);
2076
+ }, record.model.session, false)[0].rec_name;
2090
2077
  }
2078
+ Sao.setdefault(
2079
+ record._values, this.name + '.', {}).rec_name = rec_name;
2091
2080
  record._values[this.name] = value;
2092
2081
  },
2093
2082
  set_client: function(record, value, force_change) {
@@ -2638,26 +2627,21 @@
2638
2627
  }
2639
2628
  var rec_name = (
2640
2629
  record._values[this.name + '.'] || {}).rec_name || '';
2641
- var store_rec_name = function(rec_name) {
2642
- Sao.setdefault(
2643
- record._values, this.name + '.', {}).rec_name = rec_name;
2644
- }.bind(this);
2645
2630
  if (ref_model && ref_id !== null && ref_id >= 0) {
2646
2631
  if (!rec_name && ref_id >= 0) {
2647
- Sao.rpc({
2632
+ rec_name = Sao.rpc({
2648
2633
  'method': 'model.' + ref_model + '.read',
2649
2634
  'params': [[ref_id], ['rec_name'], record.get_context()]
2650
- }, record.model.session).done(function(result) {
2651
- store_rec_name(result[0].rec_name);
2652
- });
2635
+ }, record.model.session, false)[0].rec_name;
2653
2636
  }
2654
2637
  } else if (ref_model) {
2655
2638
  rec_name = '';
2656
2639
  } else {
2657
2640
  rec_name = ref_id;
2658
2641
  }
2642
+ Sao.setdefault(
2643
+ record._values, this.name + '.', {}).rec_name = rec_name;
2659
2644
  record._values[this.name] = [ref_model, ref_id];
2660
- store_rec_name(rec_name);
2661
2645
  },
2662
2646
  get_on_change_value: function(record) {
2663
2647
  if ((record.group.parent_name == this.name) &&
package/src/pyson.js CHANGED
@@ -682,10 +682,14 @@
682
682
  });
683
683
 
684
684
  Sao.PYSON.In.eval_ = function(value, context) {
685
- if (value.v.indexOf) {
686
- return Boolean(~value.v.indexOf(value.k));
685
+ if (value.v) {
686
+ if (value.v.indexOf) {
687
+ return Boolean(~value.v.indexOf(value.k));
688
+ } else {
689
+ return !!value.v[value.k];
690
+ }
687
691
  } else {
688
- return !!value.v[value.k];
692
+ return false;
689
693
  }
690
694
  };
691
695
  Sao.PYSON.In.init_from_object = function(obj) {
package/src/rpc.js CHANGED
@@ -41,7 +41,7 @@
41
41
  name = data.error[1][0];
42
42
  msg = data.error[1][1];
43
43
  description = data.error[1][2];
44
- Sao.common.userwarning.run(msg, description)
44
+ Sao.common.userwarning.run(description, msg)
45
45
  .then(function(result) {
46
46
  if (!~['always', 'ok'].indexOf(result)) {
47
47
  dfd.reject();
package/src/screen.js CHANGED
@@ -699,11 +699,11 @@
699
699
  var value = this._parse(this.format, date.val());
700
700
  value = this._format(this.format, value);
701
701
  date.val(value);
702
- });
702
+ }.bind(this));
703
703
  mousetrap.bind('=', function(e, combo) {
704
704
  e.preventDefault();
705
705
  date.val(this._format(this.format, moment()));
706
- });
706
+ }.bind(this));
707
707
 
708
708
  Sao.common.DATE_OPERATORS.forEach(function(operator) {
709
709
  mousetrap.bind(operator[0], function(e, combo) {
@@ -1981,6 +1981,7 @@
1981
1981
  return record.model.execute(attributes.name, [values],
1982
1982
  this.context).then(function(changes) {
1983
1983
  record.set_on_change(changes);
1984
+ record.group.changed();
1984
1985
  record.group.root_group.screens.forEach(
1985
1986
  function(screen) {
1986
1987
  screen.display();
package/src/tab.js CHANGED
@@ -253,10 +253,16 @@
253
253
  this.buttons[item.id].click(item, function(event) {
254
254
  var item = event.data;
255
255
  var button = this.buttons[item.id];
256
- button.prop('disabled', true);
256
+ // Use data instead of disabled prop because the action may
257
+ // actually disable the button.
258
+ if (button.data('disabled')) {
259
+ event.preventDefault();
260
+ return;
261
+ }
262
+ button.data('disabled', true);
257
263
  (this[item.id](this) || jQuery.when())
258
264
  .always(function() {
259
- button.prop('disabled', false);
265
+ button.data('disabled', false);
260
266
  });
261
267
  }.bind(this));
262
268
  };
@@ -699,13 +705,14 @@
699
705
  menu.children().length);
700
706
  }
701
707
 
702
- if (menu_action[0] == 'print') {
703
- if (toolbars.exports.length && toolbars.print.length) {
708
+ if ((menu_action[0] == 'print') &&
709
+ toolbars.exports.length) {
710
+ button._can_be_sensitive = true;
711
+ if (toolbars.print.length) {
704
712
  menu.append(jQuery('<li/>', {
705
713
  'role': 'separator',
706
714
  'class': 'divider',
707
715
  }));
708
- button._can_be_sensitive = true;
709
716
  }
710
717
  toolbars.exports.forEach(function(export_) {
711
718
  var item = jQuery('<li/>', {
package/src/view/form.js CHANGED
@@ -955,6 +955,7 @@ function eval_pyson(value){
955
955
  this.el = jQuery('<button/>', {
956
956
  'class': this.class_ + ' btn btn-link',
957
957
  'name': attributes.name,
958
+ 'type': 'button',
958
959
  });
959
960
  if (attributes.icon) {
960
961
  var img = jQuery('<img/>', {
package/src/view/tree.js CHANGED
@@ -2057,9 +2057,13 @@
2057
2057
  }.bind(this));
2058
2058
  }
2059
2059
  } else {
2060
- this._get_column_td(next_column, next_row)
2061
- .trigger('click')
2062
- .find(':input,[tabindex=0]').focus();
2060
+ prm.then(function() {
2061
+ this._get_column_td(
2062
+ next_column, next_row)
2063
+ .trigger('click')
2064
+ .find(':input,[tabindex=0]')
2065
+ .focus();
2066
+ }.bind(this));
2063
2067
  }
2064
2068
  }
2065
2069
  }.bind(this));
package/tests/sao.js CHANGED
@@ -782,6 +782,12 @@
782
782
  new Sao.PYSON.In('test', []));
783
783
  QUnit.strictEqual(new Sao.PYSON.Decoder().decode(eval_), false,
784
784
  "decode(In('test', []))");
785
+
786
+ eval_ = new Sao.PYSON.Encoder().encode(
787
+ new Sao.PYSON.In('test', new Sao.PYSON.Eval('foo', [])));
788
+ QUnit.strictEqual(new Sao.PYSON.Decoder({'foo': null}).decode(eval_),
789
+ false, "decode(In('test', Eval('foo', [])))");
790
+
785
791
  QUnit.strictEqual(new Sao.PYSON.In('foo', ['foo', 'bar']).toString(),
786
792
  'In("foo", ["foo", "bar"])');
787
793
  });