tryton-sao 7.0.48 → 7.0.49

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": "7.0.48",
5
+ "version": "7.0.49",
6
6
  "homepage": "http://www.tryton.org/",
7
7
  "author": {
8
8
  "name": "Tryton"
package/src/model.js CHANGED
@@ -955,7 +955,7 @@
955
955
  this.group.parent.id;
956
956
  }
957
957
  }
958
- return this.set_default(values);
958
+ return this.set_default(values).then(() => values);
959
959
  });
960
960
  }
961
961
  return jQuery.when();
package/src/sao.js CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  /* eslint-disable no-redeclare */
5
5
  var Sao = {
6
- __version__: '7.0.48',
6
+ __version__: '7.0.49',
7
7
  };
8
8
  /* eslint-enable no-redeclare */
9
9
 
package/src/sao.less CHANGED
@@ -238,14 +238,11 @@ html.accesskey {
238
238
  padding: 0 2px;
239
239
  position: absolute;
240
240
  text-transform: uppercase;
241
- margin: 0 -1em;
241
+ left: -1em;
242
+ right: 0;
242
243
  z-index: 5;
243
244
  }
244
245
 
245
- input[accesskey][type="checkbox"]:after {
246
- background-color: initial;
247
- }
248
-
249
246
  *[accesskey] ~ span[data-accesskey] {
250
247
  float: right;
251
248
  position: relative;
@@ -259,11 +256,15 @@ html.accesskey {
259
256
  content: attr(accesskey);
260
257
  }
261
258
 
262
- input[accesskey][type="checkbox"],
263
- input[accesskey][type="checkbox"],
264
- select[accesskey] {
265
- & ~ span[data-accesskey] {
266
- bottom: 1em;
259
+ &[dir="rtl"] {
260
+ *[accesskey] ~ span[data-accesskey]:after,
261
+ *[accesskey]:after {
262
+ left: 0;
263
+ right: -1em;
264
+ }
265
+
266
+ *[accesskey] ~ span[data-accesskey] {
267
+ float: left;
267
268
  }
268
269
  }
269
270
  }
package/src/tab.js CHANGED
@@ -13,6 +13,7 @@
13
13
  this.name = '';
14
14
  this.name_el = jQuery('<span/>');
15
15
  this.view_prm = jQuery.when();
16
+ this._action_running = false;
16
17
  },
17
18
  menu_def: function() {
18
19
  return [
@@ -153,8 +154,13 @@
153
154
  this.menu_buttons[item.id] = menuitem;
154
155
  link.click(evt => {
155
156
  evt.preventDefault();
156
- if (!menuitem.hasClass('disabled')) {
157
- this[item.id]();
157
+ if (!menuitem.hasClass('disabled')
158
+ && !this._action_running) {
159
+ this._action_running = true;
160
+ (this[item.id]() || jQuery.when())
161
+ .always(() => {
162
+ this._action_running = false;
163
+ });
158
164
  }
159
165
  });
160
166
  } else if (!item && previous) {
@@ -254,17 +260,14 @@
254
260
  }
255
261
  this.buttons[item.id].click(item, event => {
256
262
  var item = event.data;
257
- var button = this.buttons[item.id];
258
- // Use data instead of disabled prop because the action may
259
- // actually disable the button.
260
- if (button.data('disabled')) {
263
+ if (this._action_running) {
261
264
  event.preventDefault();
262
265
  return;
263
266
  }
264
- button.data('disabled', true);
267
+ this._action_running = true;
265
268
  (this[item.id](this) || jQuery.when())
266
- .always(function() {
267
- button.data('disabled', false);
269
+ .always(() => {
270
+ this._action_running = false;
268
271
  });
269
272
  });
270
273
  };
@@ -838,7 +841,7 @@
838
841
  } else {
839
842
  prm = jQuery.when();
840
843
  }
841
- prm.then(() => {
844
+ return prm.then(() => {
842
845
  var access = Sao.common.MODELACCESS.get(this.screen.model_name);
843
846
  if (this.screen.readonly || !(access.write || access.create)) {
844
847
  return jQuery.Deferred().reject();
@@ -940,18 +943,18 @@
940
943
  },
941
944
  previous: function() {
942
945
  return this.modified_save().then(() => {
943
- var prm = this.screen.display_previous();
944
- this.info_bar.clear();
945
- this.set_buttons_sensitive();
946
- return prm;
946
+ return this.screen.display_previous().then(() => {
947
+ this.info_bar.clear();
948
+ this.set_buttons_sensitive();
949
+ });
947
950
  });
948
951
  },
949
952
  next: function() {
950
953
  return this.modified_save().then(() => {
951
- var prm = this.screen.display_next();
952
- this.info_bar.clear();
953
- this.set_buttons_sensitive();
954
- return prm;
954
+ return this.screen.display_next().then(() => {
955
+ this.info_bar.clear();
956
+ this.set_buttons_sensitive();
957
+ });
955
958
  });
956
959
  },
957
960
  search: function() {
package/src/view/form.js CHANGED
@@ -370,7 +370,8 @@ function eval_pyson(value){
370
370
  }
371
371
  }
372
372
  return jQuery.when.apply(jQuery,promesses)
373
- .done(() => {
373
+ .then(() => {
374
+ let promesses = [];
374
375
  var record = this.record;
375
376
  for (const name in this.widgets) {
376
377
  var widgets = this.widgets[name];
@@ -382,10 +383,12 @@ function eval_pyson(value){
382
383
  field.set_state(record);
383
384
  }
384
385
  for (const widget of widgets) {
385
- widget.display();
386
+ let prm = widget.display();
387
+ if (prm) {
388
+ promesses.push(prm);
389
+ }
386
390
  }
387
391
  }
388
- var promesses = [];
389
392
  for (const j in this.state_widgets) {
390
393
  var state_widget = this.state_widgets[j];
391
394
  var prm = state_widget.set_state(record);
@@ -398,7 +401,7 @@ function eval_pyson(value){
398
401
  }
399
402
  // re-set the grid templates for the StateWidget that are
400
403
  // asynchronous
401
- jQuery.when.apply(jQuery, promesses).done(() => {
404
+ return jQuery.when.apply(jQuery, promesses).then(() => {
402
405
  for (const container of this.containers) {
403
406
  container.set_grid_template();
404
407
  }
@@ -2131,11 +2134,13 @@ function eval_pyson(value){
2131
2134
  this.el = jQuery('<div/>', {
2132
2135
  'class': this.class_
2133
2136
  });
2137
+ this.group = jQuery('<div/>', {
2138
+ 'class': 'input-group input-group-sm'
2139
+ }).css('width', '100%').appendTo(this.el);
2134
2140
  this.select = this.labelled = jQuery('<select/>', {
2135
2141
  'class': 'form-control input-sm mousetrap',
2136
2142
  'name': attributes.name,
2137
- });
2138
- this.el.append(this.select);
2143
+ }).appendTo(this.group);
2139
2144
  this.select.change(this.focus_out.bind(this));
2140
2145
  Sao.common.selection_mixin.init.call(this);
2141
2146
  this.init_selection();
@@ -2236,11 +2241,14 @@ function eval_pyson(value){
2236
2241
  this.el = jQuery('<div/>', {
2237
2242
  'class': this.class_
2238
2243
  });
2244
+ this.group = jQuery('<div/>', {
2245
+ 'class': 'input-group input-group-sm'
2246
+ }).css('width', '100%').appendTo(this.el);
2239
2247
  this.input = this.labelled = jQuery('<input/>', {
2240
2248
  'type': 'checkbox',
2241
2249
  'class': 'form-control input-sm mousetrap',
2242
2250
  'name': attributes.name,
2243
- }).appendTo(this.el);
2251
+ }).appendTo(this.group);
2244
2252
  this.input.change(this.focus_out.bind(this));
2245
2253
  this.input.click(function() {
2246
2254
  // Dont trigger click if field is readonly as readonly has no
@@ -3435,7 +3443,7 @@ function eval_pyson(value){
3435
3443
  display: function() {
3436
3444
  Sao.View.Form.One2Many._super.display.call(this);
3437
3445
 
3438
- this.prm.done(() => {
3446
+ return this.prm.then(() => {
3439
3447
  this._set_button_sensitive();
3440
3448
 
3441
3449
  var record = this.record;
@@ -3445,8 +3453,7 @@ function eval_pyson(value){
3445
3453
  this.screen.new_group();
3446
3454
  this.screen.current_record = null;
3447
3455
  this.screen.group.parent = null;
3448
- this.screen.display();
3449
- return;
3456
+ return this.screen.display();
3450
3457
  }
3451
3458
 
3452
3459
  var new_group = record.field_get_client(this.field_name);
@@ -3475,13 +3482,13 @@ function eval_pyson(value){
3475
3482
  this.screen.domain = domain;
3476
3483
  }
3477
3484
  this.screen.size_limit = size_limit;
3478
- this.screen.display();
3479
3485
  if (this.attributes.height !== undefined) {
3480
3486
  this.content
3481
3487
  .find('.treeview,.list-form').first()
3482
3488
  .css('min-height', this.attributes.height + 'px')
3483
3489
  .css('max-height', this.attributes.height + 'px');
3484
3490
  }
3491
+ return this.screen.display();
3485
3492
  });
3486
3493
  },
3487
3494
  focus: function() {
@@ -3754,9 +3761,7 @@ function eval_pyson(value){
3754
3761
  return prm;
3755
3762
  },
3756
3763
  set_value: function() {
3757
- if (this.screen.modified()) { // TODO check if required
3758
- this.view.screen.record_modified(false);
3759
- }
3764
+ this.screen.current_view.set_value();
3760
3765
  },
3761
3766
  _update_completion: function(text) {
3762
3767
  if (!this.record) {
@@ -3960,7 +3965,7 @@ function eval_pyson(value){
3960
3965
  display: function() {
3961
3966
  Sao.View.Form.Many2Many._super.display.call(this);
3962
3967
 
3963
- this.prm.done(() => {
3968
+ return this.prm.then(() => {
3964
3969
  var record = this.record;
3965
3970
  var field = this.field;
3966
3971
 
@@ -3968,20 +3973,19 @@ function eval_pyson(value){
3968
3973
  this.screen.new_group();
3969
3974
  this.screen.current_record = null;
3970
3975
  this.screen.group.parent = null;
3971
- this.screen.display();
3972
- return;
3976
+ return this.screen.display();
3973
3977
  }
3974
3978
  var new_group = record.field_get_client(this.field_name);
3975
3979
  if (new_group != this.screen.group) {
3976
3980
  this.screen.set_group(new_group);
3977
3981
  }
3978
- this.screen.display();
3979
3982
  if (this.attributes.height !== undefined) {
3980
3983
  this.content
3981
3984
  .find('.treeview,.list-form').first()
3982
3985
  .css('min-height', this.attributes.height + 'px')
3983
3986
  .css('max-height', this.attributes.height + 'px');
3984
3987
  }
3988
+ return this.screen.display();
3985
3989
  });
3986
3990
  },
3987
3991
  focus: function() {
package/src/view/tree.js CHANGED
@@ -2591,6 +2591,10 @@
2591
2591
  fields, false, false, true)) {
2592
2592
  var value = cell.prop('checked');
2593
2593
  this.field.set_client(record, value);
2594
+ if (record !== current_record) {
2595
+ // we can not rely on editable tree handler to save the row
2596
+ record.save();
2597
+ }
2594
2598
  } else {
2595
2599
  evt.preventDefault();
2596
2600
  }