tryton-sao 7.2.8 → 7.2.10

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.10 - 2024-11-06
3
+ ---------------------------
4
+ * Bug fixes (see mercurial logs for details)
5
+
6
+
7
+ Version 7.2.9 - 2024-10-18
8
+ --------------------------
9
+ * Bug fixes (see mercurial logs for details)
10
+
11
+
2
12
  Version 7.2.8 - 2024-10-05
3
13
  --------------------------
4
14
  * Bug fixes (see mercurial logs for details)
@@ -3,7 +3,7 @@
3
3
 
4
4
  /* eslint-disable no-redeclare */
5
5
  var Sao = {
6
- __version__: '7.2.8',
6
+ __version__: '7.2.10',
7
7
  };
8
8
  /* eslint-enable no-redeclare */
9
9
 
@@ -4588,10 +4588,18 @@ var Sao = {
4588
4588
  .replace('not', '!').trim();
4589
4589
  }
4590
4590
  if (operator.endsWith('in')) {
4591
- if (operator == 'not in') {
4592
- operator = '!';
4591
+ if (value instanceof Array && value.length == 1) {
4592
+ if (operator == 'not in') {
4593
+ operator = '!=';
4594
+ } else {
4595
+ operator = '=';
4596
+ }
4593
4597
  } else {
4594
- operator = '';
4598
+ if (operator == 'not in') {
4599
+ operator = '!';
4600
+ } else {
4601
+ operator = '';
4602
+ }
4595
4603
  }
4596
4604
  }
4597
4605
  var formatted_value = this.format_value(field, value, target);
@@ -5229,10 +5237,13 @@ var Sao = {
5229
5237
  .replace(escape + '%', '%')
5230
5238
  .replace(escape + '_', '_');
5231
5239
  },
5232
- quote: function(value) {
5240
+ quote: function(value, empty=false) {
5233
5241
  if (typeof value != 'string') {
5234
5242
  return value;
5235
5243
  }
5244
+ if (empty && value === '') {
5245
+ return '""';
5246
+ }
5236
5247
  if (value.contains('\\')) {
5237
5248
  value = value.replace(new RegExp('\\\\', 'g'), '\\\\');
5238
5249
  }
@@ -5391,7 +5402,8 @@ var Sao = {
5391
5402
  return value;
5392
5403
  }
5393
5404
  },
5394
- format_value: function(field, value, target=null, context={}) {
5405
+ format_value: function(
5406
+ field, value, target=null, context={}, _quote_empty=false) {
5395
5407
  var format_float = function() {
5396
5408
  if (!value && value !== 0 && value !== new Sao.Decimal(0)) {
5397
5409
  return '';
@@ -5502,7 +5514,9 @@ var Sao = {
5502
5514
  };
5503
5515
  converts.timestamp = converts.datetime;
5504
5516
  if (value instanceof Array) {
5505
- return value.map(v => this.format_value(field, v)).join(';');
5517
+ return value.map(
5518
+ v => this.format_value(field, v, null, context, true))
5519
+ .join(';');
5506
5520
  } else {
5507
5521
  var func = converts[field.type];
5508
5522
  if (func) {
@@ -5510,7 +5524,7 @@ var Sao = {
5510
5524
  } else if (value === null) {
5511
5525
  return '';
5512
5526
  } else {
5513
- return this.quote(value);
5527
+ return this.quote(value, _quote_empty);
5514
5528
  }
5515
5529
  }
5516
5530
  },
@@ -13905,10 +13919,10 @@ var Sao = {
13905
13919
  if (previous_view.view_type == 'calendar') {
13906
13920
  previous_view.set_default_date(record, selected_date);
13907
13921
  }
13908
- this.display().done(() => {
13922
+ return this.display().then(() => {
13909
13923
  this.set_cursor(true, true);
13924
+ return record;
13910
13925
  });
13911
- return record;
13912
13926
  });
13913
13927
  });
13914
13928
  },
@@ -20152,7 +20166,7 @@ function eval_pyson(value){
20152
20166
  this.input.prop('disabled', readonly);
20153
20167
  },
20154
20168
  set_value: function(value) {
20155
- this.input.prop('checked', value);
20169
+ this.input.prop('checked', Boolean(value));
20156
20170
  }
20157
20171
  });
20158
20172
 
@@ -20255,7 +20269,8 @@ function eval_pyson(value){
20255
20269
  return value;
20256
20270
  },
20257
20271
  set_value: function(value, options) {
20258
- if (value !== null) {
20272
+ if ((typeof(value) == 'number') ||
20273
+ (value instanceof Sao.Decimal)) {
20259
20274
  this.input.val(value);
20260
20275
  this.input_text.val(value.toLocaleString(
20261
20276
  Sao.i18n.BC47(Sao.i18n.getlang()), options));
@@ -20390,7 +20405,13 @@ function eval_pyson(value){
20390
20405
  return this._parse(this.format, this.input.val());
20391
20406
  },
20392
20407
  set_value: function(value) {
20393
- this.input.val(this._format(this.format, value));
20408
+ if ((value instanceof Sao.DateTime) ||
20409
+ (value instanceof Sao.Date)) {
20410
+ value = this._format(this.format, value);
20411
+ } else {
20412
+ value = '';
20413
+ }
20414
+ this.input.val(value);
20394
20415
  },
20395
20416
  });
20396
20417
 
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.8",
5
+ "version": "7.2.10",
6
6
  "homepage": "http://www.tryton.org/",
7
7
  "author": {
8
8
  "name": "Tryton"
package/src/common.js CHANGED
@@ -1293,10 +1293,18 @@
1293
1293
  .replace('not', '!').trim();
1294
1294
  }
1295
1295
  if (operator.endsWith('in')) {
1296
- if (operator == 'not in') {
1297
- operator = '!';
1296
+ if (value instanceof Array && value.length == 1) {
1297
+ if (operator == 'not in') {
1298
+ operator = '!=';
1299
+ } else {
1300
+ operator = '=';
1301
+ }
1298
1302
  } else {
1299
- operator = '';
1303
+ if (operator == 'not in') {
1304
+ operator = '!';
1305
+ } else {
1306
+ operator = '';
1307
+ }
1300
1308
  }
1301
1309
  }
1302
1310
  var formatted_value = this.format_value(field, value, target);
@@ -1934,10 +1942,13 @@
1934
1942
  .replace(escape + '%', '%')
1935
1943
  .replace(escape + '_', '_');
1936
1944
  },
1937
- quote: function(value) {
1945
+ quote: function(value, empty=false) {
1938
1946
  if (typeof value != 'string') {
1939
1947
  return value;
1940
1948
  }
1949
+ if (empty && value === '') {
1950
+ return '""';
1951
+ }
1941
1952
  if (value.contains('\\')) {
1942
1953
  value = value.replace(new RegExp('\\\\', 'g'), '\\\\');
1943
1954
  }
@@ -2096,7 +2107,8 @@
2096
2107
  return value;
2097
2108
  }
2098
2109
  },
2099
- format_value: function(field, value, target=null, context={}) {
2110
+ format_value: function(
2111
+ field, value, target=null, context={}, _quote_empty=false) {
2100
2112
  var format_float = function() {
2101
2113
  if (!value && value !== 0 && value !== new Sao.Decimal(0)) {
2102
2114
  return '';
@@ -2207,7 +2219,9 @@
2207
2219
  };
2208
2220
  converts.timestamp = converts.datetime;
2209
2221
  if (value instanceof Array) {
2210
- return value.map(v => this.format_value(field, v)).join(';');
2222
+ return value.map(
2223
+ v => this.format_value(field, v, null, context, true))
2224
+ .join(';');
2211
2225
  } else {
2212
2226
  var func = converts[field.type];
2213
2227
  if (func) {
@@ -2215,7 +2229,7 @@
2215
2229
  } else if (value === null) {
2216
2230
  return '';
2217
2231
  } else {
2218
- return this.quote(value);
2232
+ return this.quote(value, _quote_empty);
2219
2233
  }
2220
2234
  }
2221
2235
  },
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.8',
6
+ __version__: '7.2.10',
7
7
  };
8
8
  /* eslint-enable no-redeclare */
9
9
 
package/src/screen.js CHANGED
@@ -1544,10 +1544,10 @@
1544
1544
  if (previous_view.view_type == 'calendar') {
1545
1545
  previous_view.set_default_date(record, selected_date);
1546
1546
  }
1547
- this.display().done(() => {
1547
+ return this.display().then(() => {
1548
1548
  this.set_cursor(true, true);
1549
+ return record;
1549
1550
  });
1550
- return record;
1551
1551
  });
1552
1552
  });
1553
1553
  },
package/src/view/form.js CHANGED
@@ -5317,7 +5317,7 @@ function eval_pyson(value){
5317
5317
  this.input.prop('disabled', readonly);
5318
5318
  },
5319
5319
  set_value: function(value) {
5320
- this.input.prop('checked', value);
5320
+ this.input.prop('checked', Boolean(value));
5321
5321
  }
5322
5322
  });
5323
5323
 
@@ -5420,7 +5420,8 @@ function eval_pyson(value){
5420
5420
  return value;
5421
5421
  },
5422
5422
  set_value: function(value, options) {
5423
- if (value !== null) {
5423
+ if ((typeof(value) == 'number') ||
5424
+ (value instanceof Sao.Decimal)) {
5424
5425
  this.input.val(value);
5425
5426
  this.input_text.val(value.toLocaleString(
5426
5427
  Sao.i18n.BC47(Sao.i18n.getlang()), options));
@@ -5555,7 +5556,13 @@ function eval_pyson(value){
5555
5556
  return this._parse(this.format, this.input.val());
5556
5557
  },
5557
5558
  set_value: function(value) {
5558
- this.input.val(this._format(this.format, value));
5559
+ if ((value instanceof Sao.DateTime) ||
5560
+ (value instanceof Sao.Date)) {
5561
+ value = this._format(this.format, value);
5562
+ } else {
5563
+ value = '';
5564
+ }
5565
+ this.input.val(value);
5559
5566
  },
5560
5567
  });
5561
5568
 
package/tests/sao.js CHANGED
@@ -2273,7 +2273,10 @@
2273
2273
  [[['name', 'ilike', 'Doe\\%']], 'Name: =Doe%'],
2274
2274
  [[['name', 'not ilike', '%Doe%']], 'Name: !Doe'],
2275
2275
  [[['name', 'in', ['John', 'Jane']]], 'Name: John;Jane'],
2276
+ [[['name', 'in', ['John', '']]], 'Name: John;""'],
2277
+ [[['name', 'in', ['John']]], 'Name: =John'],
2276
2278
  [[['name', 'not in', ['John', 'Jane']]], 'Name: !John;Jane'],
2279
+ [[['name', 'not in', ['John']]], 'Name: !=John'],
2277
2280
  [[
2278
2281
  ['name', 'ilike', '%Doe%'],
2279
2282
  ['name', 'ilike', '%Jane%']