tryton-sao 6.6.6 → 6.6.8

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 6.6.8 - 2023-05-17
3
+ --------------------------
4
+ * Bug fixes (see mercurial logs for details)
5
+
6
+
7
+ Version 6.6.7 - 2023-05-03
8
+ --------------------------
9
+ * Bug fixes (see mercurial logs for details)
10
+
11
+
2
12
  Version 6.6.6 - 2023-04-01
3
13
  --------------------------
4
14
  * Bug fixes (see mercurial logs for details)
@@ -1,7 +1,7 @@
1
1
  /* This file is part of Tryton. The COPYRIGHT file at the top level of
2
2
  this repository contains the full copyright notices and license terms. */
3
3
  var Sao = {
4
- __version__: '6.6.6',
4
+ __version__: '6.6.8',
5
5
  };
6
6
 
7
7
  (function() {
@@ -516,7 +516,9 @@ var Sao = {
516
516
  }
517
517
  try {
518
518
  attributes.view_ids = loads(params.views || '[]');
519
- attributes.limit = loads(params.limi || 'null');
519
+ if (params.limit !== undefined) {
520
+ attributes.limit = loads(params.limit || 'null');
521
+ }
520
522
  attributes.name = loads(params.name || '""');
521
523
  attributes.search_value = loads(params.search_value || '[]');
522
524
  attributes.domain = loads(params.domain || '[]');
@@ -7388,6 +7390,25 @@ var Sao = {
7388
7390
  return el.html();
7389
7391
  };
7390
7392
 
7393
+ Sao.common.image_url = function(data) {
7394
+ if (!data) {
7395
+ return null;
7396
+ }
7397
+ var type = '';
7398
+ try {
7399
+ var xml = data;
7400
+ if (xml instanceof Uint8Array) {
7401
+ xml = new TextDecoder().decode(data);
7402
+ }
7403
+ if (jQuery.parseXML(xml)) {
7404
+ type = 'image/svg+xml';
7405
+ }
7406
+ } catch (e) {
7407
+ }
7408
+ var blob = new Blob([data], {type: type});
7409
+ return window.URL.createObjectURL(blob);
7410
+ };
7411
+
7391
7412
  }());
7392
7413
 
7393
7414
  /* This file is part of Tryton. The COPYRIGHT file at the top level of
@@ -9157,6 +9178,12 @@ var Sao = {
9157
9178
  return value;
9158
9179
  },
9159
9180
  set_client: function(record, value, force_change) {
9181
+ if (value === null) {
9182
+ value = [];
9183
+ }
9184
+ if (typeof(value) == 'string') {
9185
+ value = [value];
9186
+ }
9160
9187
  if (value) {
9161
9188
  value = value.slice().sort();
9162
9189
  }
@@ -17861,7 +17888,7 @@ function eval_pyson(value){
17861
17888
  var record = this.record;
17862
17889
  var field_size = record.expr_eval(
17863
17890
  this.attributes.size) || -1;
17864
- field_size -= this.field.get_eval(record);
17891
+ field_size -= this.field.get_eval(record).length;
17865
17892
  var win = new Sao.Window.Form(this.screen, update_sequence, {
17866
17893
  new_: true,
17867
17894
  many: field_size,
@@ -18712,17 +18739,10 @@ function eval_pyson(value){
18712
18739
  value = jQuery.when(null);
18713
18740
  }
18714
18741
  value.done(data => {
18715
- var url, blob;
18716
18742
  if (record !== this.record) {
18717
18743
  return;
18718
18744
  }
18719
- if (!data) {
18720
- url = null;
18721
- } else {
18722
- blob = new Blob([data]);
18723
- url = window.URL.createObjectURL(blob);
18724
- }
18725
- this.image.attr('src', url);
18745
+ this.image.attr('src', Sao.common.image_url(data));
18726
18746
  this.update_buttons(Boolean(data));
18727
18747
  });
18728
18748
  },
@@ -20522,6 +20542,9 @@ function eval_pyson(value){
20522
20542
 
20523
20543
  // Set column visibility depending on attributes and domain
20524
20544
  var visible_columns = 1; // start at 1 because of the checkbox
20545
+ if (this.optionals.length && !this.draggable) {
20546
+ visible_columns += 1;
20547
+ }
20525
20548
  var domain = [];
20526
20549
  if (!jQuery.isEmptyObject(this.screen.domain)) {
20527
20550
  domain.push(this.screen.domain);
@@ -20647,7 +20670,8 @@ function eval_pyson(value){
20647
20670
  }).map(function(row) {
20648
20671
  return row.el;
20649
20672
  }));
20650
- if (this.display_size < this.group.length) {
20673
+ if ((this.display_size < this.group.length) &&
20674
+ (!this.tbody.children().last().hasClass('more-row'))) {
20651
20675
  var more_row = jQuery('<tr/>', {
20652
20676
  'class': 'more-row',
20653
20677
  });
@@ -20660,8 +20684,17 @@ function eval_pyson(value){
20660
20684
  'title': Sao.i18n.gettext("More"),
20661
20685
  }).text(Sao.i18n.gettext('More')
20662
20686
  ).click(() => {
20687
+ var height = this.table.height();
20663
20688
  this.display_size += Sao.config.display_size;
20664
20689
  this.display();
20690
+ height -= this.treeview.height();
20691
+ height -= 50;
20692
+ if (this.tfoot) {
20693
+ height -= this.tfoot.height();
20694
+ }
20695
+ this.treeview[0].scroll({
20696
+ 'top': height,
20697
+ });
20665
20698
  });
20666
20699
  more_cell.append(more_button);
20667
20700
  more_row.append(more_cell);
@@ -20781,6 +20814,11 @@ function eval_pyson(value){
20781
20814
  Sao.i18n.BC47(Sao.i18n.getlang()), options);
20782
20815
  sum_ = (sum_ || 0).toLocaleString(
20783
20816
  Sao.i18n.BC47(Sao.i18n.getlang()), options);
20817
+ } else {
20818
+ selected_sum = (selected_sum || 0).toLocaleString(
20819
+ Sao.i18n.BC47(Sao.i18n.getlang()));
20820
+ sum_ = (sum_ || 0).toLocaleString(
20821
+ Sao.i18n.BC47(Sao.i18n.getlang()));
20784
20822
  }
20785
20823
  aggregate = selected_sum + ' / ' + sum_;
20786
20824
  }
@@ -22507,14 +22545,7 @@ function eval_pyson(value){
22507
22545
  }
22508
22546
  const render = () => {
22509
22547
  const set_src = data => {
22510
- var img_url, blob;
22511
- if (!data) {
22512
- img_url = null;
22513
- } else {
22514
- blob = new Blob([data]);
22515
- img_url = window.URL.createObjectURL(blob);
22516
- }
22517
- cell.attr('src', img_url);
22548
+ cell.attr('src', Sao.common.image_url(data));
22518
22549
  };
22519
22550
 
22520
22551
  var value = this.field.get_client(record);
@@ -25966,7 +25997,7 @@ function eval_pyson(value){
25966
25997
  }, this.session);
25967
25998
  }
25968
25999
  prm.then(data => {
25969
- this.export_csv(data, paths).then(() => {
26000
+ this.export_csv(data, paths, header).then(() => {
25970
26001
  this.destroy();
25971
26002
  });
25972
26003
  });
@@ -25974,7 +26005,7 @@ function eval_pyson(value){
25974
26005
  this.destroy();
25975
26006
  }
25976
26007
  },
25977
- export_csv: function(data, paths) {
26008
+ export_csv: function(data, paths, header=false) {
25978
26009
  var locale_format = this.el_csv_locale.prop('checked');
25979
26010
  var unparse_obj = {};
25980
26011
  unparse_obj.data = data.map(function(row, i) {
@@ -25992,9 +26023,13 @@ function eval_pyson(value){
25992
26023
  }
25993
26024
  Sao.common.download_file(
25994
26025
  csv, this.name + '.csv', {type: 'text/csv;charset=utf-8'});
26026
+ var size = data.length;
26027
+ if (header) {
26028
+ size -= 1;
26029
+ }
25995
26030
  return Sao.common.message.run(
25996
- Sao.i18n.ngettext('%1 record saved', '%1 records saved',
25997
- data.length));
26031
+ Sao.i18n.ngettext(
26032
+ "%1 record saved", "%1 records saved", size));
25998
26033
  },
25999
26034
  set_url: function() {
26000
26035
  var path = [this.session.database, 'data', this.screen.model_name];
@@ -26007,7 +26042,8 @@ function eval_pyson(value){
26007
26042
  } else {
26008
26043
  domain = this.screen.search_domain(
26009
26044
  this.screen.screen_container.get_text());
26010
- if (!this.ignore_search_limit.prop('checked')) {
26045
+ if (!this.ignore_search_limit.prop('checked') &&
26046
+ this.screen.limit !== null) {
26011
26047
  query_string.push(['s', this.screen.limit.toString()]);
26012
26048
  query_string.push(
26013
26049
  ['p', Math.floor(