tryton-sao 7.0.49 → 7.0.51

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.49",
5
+ "version": "7.0.51",
6
6
  "homepage": "http://www.tryton.org/",
7
7
  "author": {
8
8
  "name": "Tryton"
package/src/common.js CHANGED
@@ -1621,7 +1621,9 @@
1621
1621
  };
1622
1622
 
1623
1623
  var complete_datetime = function() {
1624
- return [Sao.Date(), Sao.DateTime().utc()];
1624
+ return [Sao.Date(), Sao.DateTime(
1625
+ undefined, undefined, undefined,
1626
+ 0, 0, 0, 0, true)];
1625
1627
  };
1626
1628
 
1627
1629
  var complete_date = function() {
@@ -1930,6 +1932,32 @@
1930
1932
  ]);
1931
1933
  return;
1932
1934
  }
1935
+ if ((typeof value == 'string') &&
1936
+ ['datetime', 'timestamp'].includes(field.type) &&
1937
+ (operator == '=')) {
1938
+ let ctx, format_, parsed_date;
1939
+ if (this.context && Object.keys(this.context).length) {
1940
+ ctx = this.context;
1941
+ } else {
1942
+ ctx = {};
1943
+ }
1944
+ format_ = Sao.common.date_format(ctx.date_format);
1945
+ parsed_date = Sao.common.parse_date(format_, value);
1946
+ if (parsed_date &&
1947
+ (Sao.common.format_date(format_, parsed_date) == value)) {
1948
+ let date = Sao.DateTime.combine(parsed_date, Sao.Time());
1949
+ let next_day = Sao.DateTime(
1950
+ date.year(), date.month(), date.date(),
1951
+ date.hour(), date.minute(), date.second(),
1952
+ date.millisecond())
1953
+ next_day.add(1, 'day');
1954
+ result.push(this._clausify([
1955
+ [field_name, '>=', date],
1956
+ [field_name, '<', next_day]
1957
+ ]));
1958
+ return;
1959
+ }
1960
+ }
1933
1961
  }
1934
1962
  if (value instanceof Array) {
1935
1963
  value = value.map(
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.49',
6
+ __version__: '7.0.51',
7
7
  };
8
8
  /* eslint-enable no-redeclare */
9
9
 
package/src/sao.less CHANGED
@@ -520,6 +520,10 @@ img.icon {
520
520
  width: unit(@line-height-base, em);
521
521
  height: unit(@line-height-base, em);
522
522
  display: block;
523
+
524
+ [dir="rtl"] & {
525
+ transform: scaleX(-1);
526
+ }
523
527
  }
524
528
 
525
529
  tr.more-row {
@@ -610,6 +614,7 @@ img.icon {
610
614
  [dir="rtl"] & {
611
615
  float: right;
612
616
  margin-left: 1em;
617
+ transform: scaleX(-1);
613
618
  }
614
619
  width: unit(@line-height-base, em);
615
620
  height: unit(@line-height-base, em);
package/src/view/form.js CHANGED
@@ -3745,9 +3745,8 @@ function eval_pyson(value){
3745
3745
  var fields = this.screen.current_view.get_fields();
3746
3746
  record.validate(fields).then(validate => {
3747
3747
  if (!validate) {
3748
- this.screen.display(true);
3749
- prm.reject();
3750
- return;
3748
+ this.screen.display(true).always(() => prm.reject());
3749
+ return prm;
3751
3750
  }
3752
3751
  if (this.screen.pre_validate) {
3753
3752
  return record.pre_validate().then(
@@ -12,6 +12,7 @@
12
12
  },
13
13
  button_clicked: function(event) {
14
14
  if (Sao.common.compare(this.screen.selected_records, [this.record])) {
15
+ event.stopPropagation();
15
16
  Sao.View.ListGroupViewForm._super.button_clicked.call(this, event);
16
17
  }
17
18
  }
package/src/view/tree.js CHANGED
@@ -2591,7 +2591,7 @@
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) {
2594
+ if ((!this.group.parent) & (record !== current_record)) {
2595
2595
  // we can not rely on editable tree handler to save the row
2596
2596
  record.save();
2597
2597
  }
package/src/wizard.js CHANGED
@@ -53,6 +53,7 @@
53
53
  if (this.__processing || this.__waiting_response) {
54
54
  return;
55
55
  }
56
+ this.__processing = true;
56
57
  var process = function() {
57
58
  if (this.state == this.end_state) {
58
59
  this.end();
@@ -230,11 +231,14 @@
230
231
  this.footer.empty();
231
232
  },
232
233
  _get_button: function(definition) {
234
+ let state = this.state;
233
235
  var button = Sao.Wizard.Form._super._get_button.call(this,
234
236
  definition);
235
237
  this.footer.append(button.el);
236
238
  button.el.click(() => {
237
- this.response(definition);
239
+ if (this.state === state) {
240
+ this.response(definition);
241
+ }
238
242
  });
239
243
  return button;
240
244
  },
@@ -282,19 +286,24 @@
282
286
  this.footer.empty();
283
287
  },
284
288
  _get_button: function(definition) {
289
+ let state = this.state;
285
290
  var button = Sao.Wizard.Dialog._super._get_button.call(this,
286
291
  definition);
287
292
  this.footer.append(button.el);
288
293
  if (definition['default']) {
289
294
  this.content.unbind('submit');
290
295
  this.content.submit(e => {
291
- this.response(definition);
292
296
  e.preventDefault();
297
+ if (this.state === state) {
298
+ this.response(definition);
299
+ }
293
300
  });
294
301
  button.el.attr('type', 'submit');
295
302
  } else {
296
303
  button.el.click(() => {
297
- this.response(definition);
304
+ if (this.state === state) {
305
+ this.response(definition);
306
+ }
298
307
  });
299
308
  }
300
309
  return button;
package/tests/sao.js CHANGED
@@ -1908,6 +1908,12 @@
1908
1908
  'name': 'integer',
1909
1909
  'type': 'integer'
1910
1910
  },
1911
+ 'timestamp': {
1912
+ 'name': 'timestamp',
1913
+ 'string': 'Timestamp',
1914
+ 'type': 'timestamp',
1915
+ 'format': '"%H:%M:%S"',
1916
+ },
1911
1917
  'selection': {
1912
1918
  'string': 'Selection',
1913
1919
  'name': 'selection',
@@ -1996,6 +2002,7 @@
1996
2002
  c(['integer', '>=', 3]),
1997
2003
  c(['integer', '<=', 5])
1998
2004
  ]]],
2005
+ [[c(['Timestamp', null, null])], [c(['timestamp', '=', null])]],
1999
2006
  [[c(['Reference', null, 'foo'])],
2000
2007
  [c(['reference', 'ilike', '%foo%'])]],
2001
2008
  [[c(['Reference', null, 'Spam'])],
@@ -2027,6 +2034,33 @@
2027
2034
  QUnit.deepEqual(parser.parse_clause(value), result,
2028
2035
  'parse_clause(' + JSON.stringify(value) + ')');
2029
2036
  });
2037
+
2038
+ let clause = parser.parse_clause([c(
2039
+ ['Timestamp', '=', Sao.common.format_date('%x', Sao.Date(2002, 12, 4))])]);
2040
+ QUnit.assert.strictEqual(clause[0].length, 2);
2041
+ let [ , operator, value] = clause[0][0];
2042
+ QUnit.assert.strictEqual(operator, '>=');
2043
+ QUnit.assert.ok(value.isSame(Sao.Date(2002, 12, 4)));
2044
+ [ , operator, value] = clause[0][1];
2045
+ QUnit.assert.strictEqual(operator, '<');
2046
+ QUnit.assert.ok(value.isSame(Sao.Date(2002, 12, 5)));
2047
+
2048
+ clause = parser.parse_clause([c(
2049
+ ['Timestamp', '=',
2050
+ Sao.common.format_datetime('%x %X', Sao.DateTime(2002, 12, 4, 12, 30))])]);
2051
+ [ , operator, value] = clause[0];
2052
+ QUnit.assert.strictEqual(operator, '=');
2053
+ QUnit.assert.ok(value.isSame(Sao.DateTime(2002, 12, 4, 12, 30)));
2054
+
2055
+ clause = parser.parse_clause([c(
2056
+ ['Timestamp', null, [
2057
+ `${Sao.common.format_date('%x', Sao.Date(2002, 12, 4))}`,
2058
+ `${Sao.common.format_date('%x', Sao.Date(2002, 12, 5))}`,
2059
+ ]])]);
2060
+ [ , operator, value] = clause[0];
2061
+ QUnit.assert.strictEqual(operator, 'in');
2062
+ QUnit.assert.ok(value[0].isSame(Sao.DateTime(2002, 12, 4)));
2063
+ QUnit.assert.ok(value[1].isSame(Sao.DateTime(2002, 12, 5)));
2030
2064
  });
2031
2065
 
2032
2066
  QUnit.test('DomainParser.format_value', function() {