tryton-sao 7.2.4 → 7.2.6

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 CHANGED
@@ -1,4 +1,14 @@
1
1
 
2
+ Version 7.2.6 - 2024-09-01
3
+ --------------------------
4
+ * Bug fixes (see mercurial logs for details)
5
+
6
+
7
+ Version 7.2.5 - 2024-08-01
8
+ --------------------------
9
+ * Bug fixes (see mercurial logs for details)
10
+
11
+
2
12
  Version 7.2.4 - 2024-07-17
3
13
  --------------------------
4
14
  * Bug fixes (see mercurial logs for details)
@@ -9342,12 +9342,6 @@ html[theme="default"] .carousel-caption h6 {
9342
9342
  display: flex;
9343
9343
  flex: 1;
9344
9344
  }
9345
- @media screen and (max-width: 767px) {
9346
- #tabcontent > .tab-pane > .panel > .panel-body {
9347
- flex-direction: column-reverse;
9348
- min-height: unset;
9349
- }
9350
- }
9351
9345
  #tabcontent[data-view-type="tree"] {
9352
9346
  display: flex;
9353
9347
  flex: 1;
@@ -9679,9 +9673,7 @@ img.icon {
9679
9673
  border-style: solid;
9680
9674
  border-width: 0 0 0 1px;
9681
9675
  flex: 1;
9682
- margin-left: 5px;
9683
- min-width: 20%;
9684
- overflow: auto;
9676
+ overflow: unset;
9685
9677
  }
9686
9678
  .attachment-preview > div {
9687
9679
  flex: 1;
@@ -9691,8 +9683,10 @@ img.icon {
9691
9683
  }
9692
9684
  @media screen and (max-width: 991px) {
9693
9685
  .attachment-preview:not(:empty) {
9694
- border-width: 0 0 1px 0;
9695
- margin-bottom: 5px;
9686
+ flex: 2;
9687
+ }
9688
+ .attachment-preview:not(:empty) > div.preview-resizer {
9689
+ resize: none;
9696
9690
  }
9697
9691
  }
9698
9692
  .list-form {
@@ -10340,8 +10334,8 @@ input.column-boolean {
10340
10334
  float: none;
10341
10335
  }
10342
10336
  @media screen and (max-width: 767px) {
10343
- .treeview {
10344
- height: calc(100vh - 370px);
10337
+ .dict-row {
10338
+ grid-column: 1;
10345
10339
  }
10346
10340
  .dict-label {
10347
10341
  text-align: left;
@@ -3,7 +3,7 @@
3
3
 
4
4
  /* eslint-disable no-redeclare */
5
5
  var Sao = {
6
- __version__: '7.2.4',
6
+ __version__: '7.2.6',
7
7
  };
8
8
  /* eslint-enable no-redeclare */
9
9
 
@@ -4485,7 +4485,7 @@ var Sao = {
4485
4485
  },
4486
4486
  stringable: function(domain) {
4487
4487
  const stringable_ = clause => {
4488
- if (!clause) {
4488
+ if (!clause || jQuery.isEmptyObject(clause)) {
4489
4489
  return true;
4490
4490
  }
4491
4491
  var is_array = function(e) {
@@ -10544,12 +10544,11 @@ var Sao = {
10544
10544
  Sao.field.Dict._super.set.call(this, record, value);
10545
10545
  },
10546
10546
  get: function(record) {
10547
- return (Sao.field.Dict._super.get.call(this, record) ||
10548
- this._default);
10547
+ return jQuery.extend(
10548
+ {}, Sao.field.Dict._super.get.call(this, record));
10549
10549
  },
10550
10550
  get_client: function(record) {
10551
- return (Sao.field.Dict._super.get_client.call(this, record) ||
10552
- this._default);
10551
+ return Sao.field.Dict._super.get_client.call(this, record);
10553
10552
  },
10554
10553
  validation_domains: function(record, pre_validate) {
10555
10554
  return this.get_domains(record, pre_validate)[0];
@@ -17601,6 +17600,7 @@ function eval_pyson(value){
17601
17600
  params.name = this.attributes.string;
17602
17601
  params.context = this.field.get_context(this.record);
17603
17602
  Sao.Tab.create(params);
17603
+ this._popup = false;
17604
17604
  return;
17605
17605
  }
17606
17606
  var screen = this.get_screen();
@@ -19590,7 +19590,7 @@ function eval_pyson(value){
19590
19590
  },
19591
19591
  set_url: function(value) {
19592
19592
  this.button.attr('href', value);
19593
- this.button.toggle(value);
19593
+ this.button.toggle(Boolean(value));
19594
19594
  },
19595
19595
  set_invisible: function(invisible) {
19596
19596
  Sao.View.Form.URL._super.set_invisible.call(this, invisible);
@@ -19844,6 +19844,7 @@ function eval_pyson(value){
19844
19844
  for (const key of new_names) {
19845
19845
  value[key] = null;
19846
19846
  }
19847
+ this.field.set_client(this.record, value);
19847
19848
  this._display().then(() => {
19848
19849
  this.fields[new_names[0]].input.focus();
19849
19850
  });
@@ -20226,7 +20227,9 @@ function eval_pyson(value){
20226
20227
  return value.map(function(e) { return JSON.parse(e); });
20227
20228
  },
20228
20229
  set_value: function(value) {
20229
- value = value.map(function(e) { return JSON.stringify(e); });
20230
+ if (value) {
20231
+ value = value.map(function(e) { return JSON.stringify(e); });
20232
+ }
20230
20233
  this.input.val(value);
20231
20234
  }
20232
20235
  });
@@ -20999,13 +21002,14 @@ function eval_pyson(value){
20999
21002
  this.selected_records.forEach((record) => {
21000
21003
  var values = [];
21001
21004
  this.columns.forEach((col) => {
21002
- if (!col.get_visible() || !col.attributes.name) {
21005
+ if (!col.get_visible() || !col.attributes.name ||
21006
+ col instanceof Sao.View.Tree.ButtonColumn) {
21003
21007
  return;
21004
21008
  }
21005
21009
  var text;
21006
21010
  if (!record.is_loaded(col.attributes.name)) {
21007
21011
  try {
21008
- record.load(this.attributes.name, false, false);
21012
+ record.load(col.attributes.name, false, false);
21009
21013
  text = col.get_textual_value(record);
21010
21014
  } catch (e) {
21011
21015
  Sao.Logger.error(
@@ -21423,6 +21427,7 @@ function eval_pyson(value){
21423
21427
  }).map(function(row) {
21424
21428
  return row.el;
21425
21429
  }));
21430
+ this.update_selection(); // update after new rows has been added
21426
21431
  if ((this.display_size < this.group.length) &&
21427
21432
  (!this.tbody.children().last().hasClass('more-row'))) {
21428
21433
  var more_row = jQuery('<tr/>', {
@@ -21487,9 +21492,7 @@ function eval_pyson(value){
21487
21492
  }
21488
21493
  },
21489
21494
  redraw: function(selected, expanded) {
21490
- return redraw_async(this.rows, selected, expanded).then(() => {
21491
- this.update_selection();
21492
- });
21495
+ return redraw_async(this.rows, selected, expanded);
21493
21496
  },
21494
21497
  switch_: function(path) {
21495
21498
  this.screen.row_activate();
@@ -21714,9 +21717,9 @@ function eval_pyson(value){
21714
21717
  this.selection.prop('indeterminate', false);
21715
21718
  if (jQuery.isEmptyObject(selected_records)) {
21716
21719
  this.selection.prop('checked', false);
21717
- } else if (selected_records.length ==
21718
- this.tbody.children().length &&
21719
- this.display_size >= this.group.length) {
21720
+ } else if (
21721
+ this.rows.every((row) => row.is_selected()) &&
21722
+ (selected_records.length >= this.tbody.children().length)) {
21720
21723
  this.selection.prop('checked', true);
21721
21724
  } else {
21722
21725
  this.selection.prop('indeterminate', true);
@@ -23982,7 +23985,15 @@ function eval_pyson(value){
23982
23985
  }, ctx, false);
23983
23986
  },
23984
23987
  _action_key: function(data) {
23985
- return data.x;
23988
+ var x = data.x;
23989
+ var type = this.view.screen.model.fields[this.xfield.name]
23990
+ .description.type;
23991
+ if (x && (type == 'datetime')) {
23992
+ x = Sao.DateTime(x).toString();
23993
+ } else if (x && (type == 'date')) {
23994
+ x = Sao.Date(x).toString();
23995
+ }
23996
+ return x;
23986
23997
  }
23987
23998
  });
23988
23999
 
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.2.4",
5
+ "version": "7.2.6",
6
6
  "homepage": "http://www.tryton.org/",
7
7
  "author": {
8
8
  "name": "Tryton"
package/src/common.js CHANGED
@@ -1190,7 +1190,7 @@
1190
1190
  },
1191
1191
  stringable: function(domain) {
1192
1192
  const stringable_ = clause => {
1193
- if (!clause) {
1193
+ if (!clause || jQuery.isEmptyObject(clause)) {
1194
1194
  return true;
1195
1195
  }
1196
1196
  var is_array = function(e) {
package/src/model.js CHANGED
@@ -2906,12 +2906,11 @@
2906
2906
  Sao.field.Dict._super.set.call(this, record, value);
2907
2907
  },
2908
2908
  get: function(record) {
2909
- return (Sao.field.Dict._super.get.call(this, record) ||
2910
- this._default);
2909
+ return jQuery.extend(
2910
+ {}, Sao.field.Dict._super.get.call(this, record));
2911
2911
  },
2912
2912
  get_client: function(record) {
2913
- return (Sao.field.Dict._super.get_client.call(this, record) ||
2914
- this._default);
2913
+ return Sao.field.Dict._super.get_client.call(this, record);
2915
2914
  },
2916
2915
  validation_domains: function(record, pre_validate) {
2917
2916
  return this.get_domains(record, pre_validate)[0];
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.4',
6
+ __version__: '7.2.6',
7
7
  };
8
8
  /* eslint-enable no-redeclare */
9
9
 
package/src/sao.less CHANGED
@@ -266,15 +266,6 @@ html[theme="default"] {
266
266
  }
267
267
  }
268
268
 
269
- @media screen and (max-width: @screen-xs-max) {
270
- #tabcontent {
271
- > .tab-pane > .panel > .panel-body {
272
- flex-direction: column-reverse;
273
- min-height: unset;
274
- }
275
- }
276
- }
277
-
278
269
  #tabcontent[data-view-type="tree"] {
279
270
  display: flex;
280
271
  flex: 1;
@@ -545,9 +536,7 @@ img.icon {
545
536
  border-style: solid;
546
537
  border-width: 0 0 0 1px;
547
538
  flex: 1;
548
- margin-left: 5px;
549
- min-width: 20%;
550
- overflow: auto;
539
+ overflow: unset;
551
540
 
552
541
  > div {
553
542
  flex: 1;
@@ -560,8 +549,11 @@ img.icon {
560
549
 
561
550
  @media screen and (max-width: @screen-sm-max) {
562
551
  .attachment-preview:not(:empty) {
563
- border-width: 0 0 1px 0;
564
- margin-bottom: 5px;
552
+ flex: 2;
553
+
554
+ > div.preview-resizer {
555
+ resize: none;
556
+ }
565
557
  }
566
558
  }
567
559
 
@@ -1101,8 +1093,8 @@ input.column-boolean {
1101
1093
  }
1102
1094
 
1103
1095
  @media screen and (max-width: @screen-xs-max) {
1104
- .treeview {
1105
- height: calc(100vh - 370px);
1096
+ .dict-row {
1097
+ grid-column: 1;
1106
1098
  }
1107
1099
  .dict-label {
1108
1100
  text-align: left;
package/src/view/form.js CHANGED
@@ -2772,6 +2772,7 @@ function eval_pyson(value){
2772
2772
  params.name = this.attributes.string;
2773
2773
  params.context = this.field.get_context(this.record);
2774
2774
  Sao.Tab.create(params);
2775
+ this._popup = false;
2775
2776
  return;
2776
2777
  }
2777
2778
  var screen = this.get_screen();
@@ -4761,7 +4762,7 @@ function eval_pyson(value){
4761
4762
  },
4762
4763
  set_url: function(value) {
4763
4764
  this.button.attr('href', value);
4764
- this.button.toggle(value);
4765
+ this.button.toggle(Boolean(value));
4765
4766
  },
4766
4767
  set_invisible: function(invisible) {
4767
4768
  Sao.View.Form.URL._super.set_invisible.call(this, invisible);
@@ -5015,6 +5016,7 @@ function eval_pyson(value){
5015
5016
  for (const key of new_names) {
5016
5017
  value[key] = null;
5017
5018
  }
5019
+ this.field.set_client(this.record, value);
5018
5020
  this._display().then(() => {
5019
5021
  this.fields[new_names[0]].input.focus();
5020
5022
  });
@@ -5397,7 +5399,9 @@ function eval_pyson(value){
5397
5399
  return value.map(function(e) { return JSON.parse(e); });
5398
5400
  },
5399
5401
  set_value: function(value) {
5400
- value = value.map(function(e) { return JSON.stringify(e); });
5402
+ if (value) {
5403
+ value = value.map(function(e) { return JSON.stringify(e); });
5404
+ }
5401
5405
  this.input.val(value);
5402
5406
  }
5403
5407
  });
package/src/view/graph.js CHANGED
@@ -248,7 +248,15 @@
248
248
  }, ctx, false);
249
249
  },
250
250
  _action_key: function(data) {
251
- return data.x;
251
+ var x = data.x;
252
+ var type = this.view.screen.model.fields[this.xfield.name]
253
+ .description.type;
254
+ if (x && (type == 'datetime')) {
255
+ x = Sao.DateTime(x).toString();
256
+ } else if (x && (type == 'date')) {
257
+ x = Sao.Date(x).toString();
258
+ }
259
+ return x;
252
260
  }
253
261
  });
254
262
 
package/src/view/tree.js CHANGED
@@ -506,13 +506,14 @@
506
506
  this.selected_records.forEach((record) => {
507
507
  var values = [];
508
508
  this.columns.forEach((col) => {
509
- if (!col.get_visible() || !col.attributes.name) {
509
+ if (!col.get_visible() || !col.attributes.name ||
510
+ col instanceof Sao.View.Tree.ButtonColumn) {
510
511
  return;
511
512
  }
512
513
  var text;
513
514
  if (!record.is_loaded(col.attributes.name)) {
514
515
  try {
515
- record.load(this.attributes.name, false, false);
516
+ record.load(col.attributes.name, false, false);
516
517
  text = col.get_textual_value(record);
517
518
  } catch (e) {
518
519
  Sao.Logger.error(
@@ -930,6 +931,7 @@
930
931
  }).map(function(row) {
931
932
  return row.el;
932
933
  }));
934
+ this.update_selection(); // update after new rows has been added
933
935
  if ((this.display_size < this.group.length) &&
934
936
  (!this.tbody.children().last().hasClass('more-row'))) {
935
937
  var more_row = jQuery('<tr/>', {
@@ -994,9 +996,7 @@
994
996
  }
995
997
  },
996
998
  redraw: function(selected, expanded) {
997
- return redraw_async(this.rows, selected, expanded).then(() => {
998
- this.update_selection();
999
- });
999
+ return redraw_async(this.rows, selected, expanded);
1000
1000
  },
1001
1001
  switch_: function(path) {
1002
1002
  this.screen.row_activate();
@@ -1221,9 +1221,9 @@
1221
1221
  this.selection.prop('indeterminate', false);
1222
1222
  if (jQuery.isEmptyObject(selected_records)) {
1223
1223
  this.selection.prop('checked', false);
1224
- } else if (selected_records.length ==
1225
- this.tbody.children().length &&
1226
- this.display_size >= this.group.length) {
1224
+ } else if (
1225
+ this.rows.every((row) => row.is_selected()) &&
1226
+ (selected_records.length >= this.tbody.children().length)) {
1227
1227
  this.selection.prop('checked', true);
1228
1228
  } else {
1229
1229
  this.selection.prop('indeterminate', true);
package/tests/sao.js CHANGED
@@ -2186,6 +2186,8 @@
2186
2186
  });
2187
2187
  var valid = ['name', '=', 'Doe'];
2188
2188
  var invalid = ['surname', '=', 'John'];
2189
+ QUnit.ok(parser.stringable([]));
2190
+ QUnit.ok(parser.stringable([[]]));
2189
2191
  QUnit.ok(parser.stringable([valid]));
2190
2192
  QUnit.ok(!parser.stringable([invalid]));
2191
2193
  QUnit.ok(parser.stringable(['AND', valid]));