tryton-sao 7.0.8 → 7.0.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.0.10 - 2024-04-17
3
+ ---------------------------
4
+ * Bug fixes (see mercurial logs for details)
5
+
6
+
7
+ Version 7.0.9 - 2024-04-04
8
+ --------------------------
9
+ * Bug fixes (see mercurial logs for details)
10
+
11
+
2
12
  Version 7.0.8 - 2024-03-03
3
13
  --------------------------
4
14
  * Bug fixes (see mercurial logs for details)
package/Gruntfile.js CHANGED
@@ -75,23 +75,6 @@ module.exports = function(grunt) {
75
75
  dest: 'dist/<%= pkg.name %>.js'
76
76
  }
77
77
  },
78
- jshint: {
79
- dist: {
80
- options: {
81
- jshintrc: 'src/.jshintrc'
82
- },
83
- src: ['dist/<%= pkg.name %>.js']
84
- },
85
- grunt: {
86
- src: ['Gruntfile.js']
87
- },
88
- tests: {
89
- options: {
90
- jshintrc: 'tests/.jshintrc'
91
- },
92
- src: ['tests/*.js']
93
- }
94
- },
95
78
  uglify: {
96
79
  options: {
97
80
  banner: '/*! <%= pkg.name %>-<%= pkg.version %> | GPL-3\n' +
@@ -127,7 +110,7 @@ module.exports = function(grunt) {
127
110
  watch: {
128
111
  scripts: {
129
112
  files: ['src/**/*.js'],
130
- tasks: ['concat', 'jshint']
113
+ tasks: ['concat']
131
114
  },
132
115
  styles: {
133
116
  files: ['src/*.less'],
@@ -152,17 +135,16 @@ module.exports = function(grunt) {
152
135
  });
153
136
 
154
137
  grunt.loadNpmTasks('grunt-contrib-concat');
155
- grunt.loadNpmTasks('grunt-contrib-jshint');
156
138
  grunt.loadNpmTasks('grunt-contrib-uglify');
157
139
  grunt.loadNpmTasks('grunt-contrib-less');
158
140
  grunt.loadNpmTasks('grunt-po2json');
159
141
  grunt.loadNpmTasks('grunt-qunit-junit');
160
142
 
161
143
  grunt.registerTask('default', 'Build for production.', function() {
162
- grunt.task.run(['concat', 'jshint', 'uglify', 'less', 'po2json']);
144
+ grunt.task.run(['concat', 'uglify', 'less', 'po2json']);
163
145
  });
164
146
  grunt.registerTask('dev', 'Build for development.', function() {
165
- grunt.task.run(['concat', 'jshint', 'less:dev']);
147
+ grunt.task.run(['concat', 'less:dev']);
166
148
  });
167
149
  grunt.registerTask('devwatch', 'Watch development', function() {
168
150
  grunt.loadNpmTasks('grunt-contrib-watch');
@@ -178,7 +160,7 @@ module.exports = function(grunt) {
178
160
  });
179
161
  grunt.registerTask('test', 'Run tests', function() {
180
162
  grunt.loadNpmTasks('grunt-contrib-qunit');
181
- grunt.task.run(['concat', 'jshint', 'less:dev', 'qunit_junit', 'qunit']);
163
+ grunt.task.run(['concat', 'less:dev', 'qunit_junit', 'qunit']);
182
164
  });
183
165
 
184
166
  };
@@ -9821,6 +9821,8 @@ img.icon {
9821
9821
  .form .form-hcontainer,
9822
9822
  .form .form-vcontainer {
9823
9823
  display: grid;
9824
+ width: 100%;
9825
+ height: 100%;
9824
9826
  }
9825
9827
  .form .form-item {
9826
9828
  display: flex;
@@ -9952,8 +9954,8 @@ img.icon {
9952
9954
  .form .form-richtext > textarea,
9953
9955
  .form .form-text .richtext,
9954
9956
  .form .form-richtext .richtext {
9957
+ height: 100%;
9955
9958
  line-height: 2.5ex;
9956
- max-height: 50ex;
9957
9959
  min-height: 12.5ex;
9958
9960
  overflow: auto;
9959
9961
  resize: vertical;
@@ -1,8 +1,11 @@
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
+
4
+ /* eslint-disable no-redeclare */
3
5
  var Sao = {
4
- __version__: '7.0.8',
6
+ __version__: '7.0.10',
5
7
  };
8
+ /* eslint-enable no-redeclare */
6
9
 
7
10
  (function() {
8
11
  'use strict';
@@ -342,7 +345,7 @@ var Sao = {
342
345
  } else {
343
346
  doc_version = doc_version.join('.');
344
347
  }
345
- Sao.config.doc_url = `https://docs.tryton.org/en/${doc_version}`;
348
+ Sao.config.doc_url = `https://docs.tryton.org/${doc_version}`;
346
349
  Sao.config.bug_url = 'https://bugs.tryton.org/';
347
350
  Sao.config.title = 'Tryton';
348
351
  Sao.config.icon_colors = '#267f82,#3e4950,#e78e42'.split(',');
@@ -1201,7 +1204,7 @@ var Sao = {
1201
1204
  if (definition.id){
1202
1205
  var current_tab = Sao.Tab.tabs.get_current();
1203
1206
  if (current_tab) {
1204
- var focused = $(':focus');
1207
+ var focused = jQuery(':focus');
1205
1208
  focused.blur();
1206
1209
  current_tab.el.find('a[id="' + definition.id + '"]').click();
1207
1210
  focused.focus();
@@ -1283,7 +1286,7 @@ var Sao = {
1283
1286
  .on('hidden.bs.modal', '.modal', function(event) {
1284
1287
  setModalsAndBackdropsOrder();
1285
1288
  if (jQuery('.modal:visible').length) {
1286
- $(document.body).addClass('modal-open');
1289
+ jQuery(document.body).addClass('modal-open');
1287
1290
  }
1288
1291
  });
1289
1292
 
@@ -1812,7 +1815,7 @@ var Sao = {
1812
1815
  value = new Sao.PYSON.Bool(value);
1813
1816
  }
1814
1817
  } else if (typeof value != 'boolean') {
1815
- value = Sao.PYSON.Bool(value);
1818
+ value = new Sao.PYSON.Bool(value);
1816
1819
  }
1817
1820
  this._value = value;
1818
1821
  },
@@ -1831,7 +1834,7 @@ var Sao = {
1831
1834
  });
1832
1835
 
1833
1836
  Sao.PYSON.Not.eval_ = function(value, context) {
1834
- return !value.v;
1837
+ return !Sao.PYSON.Bool.eval_(value, context);
1835
1838
  };
1836
1839
  Sao.PYSON.Not.init_from_object = function(obj) {
1837
1840
  return new Sao.PYSON.Not(obj.v);
@@ -3424,21 +3427,14 @@ var Sao = {
3424
3427
  };
3425
3428
 
3426
3429
  Sao.common.parse_time = function(format, value) {
3427
- if (!value) {
3428
- return null;
3430
+ var date = moment(value, Sao.common.moment_format(format));
3431
+ if (date.isValid()) {
3432
+ date = Sao.Time(
3433
+ date.hour(), date.minute(), date.second(), date.millisecond());
3434
+ } else {
3435
+ date = null;
3429
3436
  }
3430
- var getNumber = function(pattern) {
3431
- var i = format.indexOf(pattern);
3432
- if (~i) {
3433
- var number = parseInt(value.slice(i, i + pattern.length), 10);
3434
- if (!isNaN(number)) {
3435
- return number;
3436
- }
3437
- }
3438
- return 0;
3439
- };
3440
- return Sao.Time(getNumber('%H'), getNumber('%M'), getNumber('%S'),
3441
- getNumber('%f'));
3437
+ return date;
3442
3438
  };
3443
3439
 
3444
3440
  Sao.common.format_date = function(date_format, date) {
@@ -6278,11 +6274,8 @@ var Sao = {
6278
6274
  load_icons: function(refresh) {
6279
6275
  refresh = refresh || false;
6280
6276
  if (!refresh) {
6281
- for (var icon_name in this.load_icons) {
6282
- if (!this.load_icons.hasOwnProperty(icon_name)) {
6283
- continue;
6284
- }
6285
- window.URL.revokeObjectURL(this.load_icons[icon_name]);
6277
+ for (var icon_name in this.loaded_icons) {
6278
+ window.URL.revokeObjectURL(this.loaded_icons[icon_name]);
6286
6279
  }
6287
6280
  }
6288
6281
 
@@ -6978,7 +6971,7 @@ var Sao = {
6978
6971
  }
6979
6972
  var prm;
6980
6973
  if (this.source instanceof Array) {
6981
- prm = jQuery.when(source.filter(function(value) {
6974
+ prm = jQuery.when(this.source.filter(function(value) {
6982
6975
  return value.toLowerCase().startsWith(text.toLowerCase());
6983
6976
  }));
6984
6977
  } else {
@@ -10999,8 +10992,10 @@ var Sao = {
10999
10992
  attributes.res_id = [attributes.res_id];
11000
10993
  }
11001
10994
  screen.load(attributes.res_id);
11002
- screen.current_record = screen.group.get(
11003
- attributes.res_id[0]);
10995
+ if (attributes.res_id.length) {
10996
+ screen.current_record = screen.group.get(
10997
+ attributes.res_id[0]);
10998
+ }
11004
10999
  screen.display();
11005
11000
  } else {
11006
11001
  if (screen.current_view.view_type == 'form') {
@@ -13872,7 +13867,7 @@ var Sao = {
13872
13867
  if (!jQuery.isEmptyObject(new_ids)) {
13873
13868
  this.current_record = this.group.get(new_ids[0]);
13874
13869
  }
13875
- this.display().always(dfd.resolve);
13870
+ this.display(true).always(dfd.resolve);
13876
13871
  }, dfd.reject);
13877
13872
  return dfd.promise();
13878
13873
  },
@@ -14597,7 +14592,6 @@ var Sao = {
14597
14592
  /* This file is part of Tryton. The COPYRIGHT file at the top level of
14598
14593
  this repository contains the full copyright notices and license terms. */
14599
14594
 
14600
- /* jshint ignore:start */
14601
14595
  // Must be defined in non strict context otherwise is invalid
14602
14596
  function eval_pyson(value){
14603
14597
  with (Sao.PYSON.eval) {
@@ -14605,7 +14599,6 @@ function eval_pyson(value){
14605
14599
  return eval('(' + value + ')');
14606
14600
  }
14607
14601
  }
14608
- /* jshint ignore:end */
14609
14602
 
14610
14603
  (function() {
14611
14604
  'use strict';
@@ -15780,7 +15773,7 @@ function eval_pyson(value){
15780
15773
  var url = new URL(name, window.location);
15781
15774
  url.searchParams.set(
15782
15775
  this.attributes.url_size,
15783
- attributes.size || 48);
15776
+ this.attributes.size || 48);
15784
15777
  name = url.href;
15785
15778
  }
15786
15779
  this.img.attr('src', name);
@@ -18683,7 +18676,7 @@ function eval_pyson(value){
18683
18676
  new Sao.Window.Form(screen, callback);
18684
18677
  });
18685
18678
  },
18686
- new_: function(defauts=null) {
18679
+ new_: function(defaults=null) {
18687
18680
  var screen = this._get_screen_form();
18688
18681
  if (defaults) {
18689
18682
  defaults = jQuery.extend({}, defaults);
@@ -20213,7 +20206,10 @@ function eval_pyson(value){
20213
20206
  this.columns = [];
20214
20207
  this.selection_mode = (screen.attributes.selection_mode ||
20215
20208
  Sao.common.SELECTION_MULTIPLE);
20216
- this.el = jQuery('<div/>');
20209
+ this.el = jQuery('<div/>')
20210
+ // Prevent Chrome based browser to compute a min-content
20211
+ // such that only this table has scrollbar if needed
20212
+ .css('display', 'grid');
20217
20213
  this.scrollbar = jQuery('<div/>')
20218
20214
  .appendTo(jQuery('<div/>', {
20219
20215
  'class': 'scrollbar responsive',
@@ -22522,7 +22518,7 @@ function eval_pyson(value){
22522
22518
  return this.attributes.name;
22523
22519
  },
22524
22520
  get model_name() {
22525
- return model.name;
22521
+ return this.model.name;
22526
22522
  },
22527
22523
  get_cell: function() {
22528
22524
  var cell = jQuery('<div/>', {
@@ -23582,7 +23578,7 @@ function eval_pyson(value){
23582
23578
  for (i = 0; i < this.yfields.length; i++) {
23583
23579
  yfield = this.yfields[i];
23584
23580
  if (yfield.color) {
23585
- colors[yfield.key || yfield.name] = field.color;
23581
+ colors[yfield.key || yfield.name] = yfield.color;
23586
23582
  }
23587
23583
  }
23588
23584
  c3_config.data.color = function(color, column) {
@@ -24215,7 +24211,7 @@ function eval_pyson(value){
24215
24211
  return records;
24216
24212
  },
24217
24213
  get listed_records() {
24218
- this.group.slice();
24214
+ return this.group.slice();
24219
24215
  },
24220
24216
  set_cursor: function(new_, reset_view) {
24221
24217
  if (new_) {
@@ -24269,11 +24265,13 @@ function eval_pyson(value){
24269
24265
  var current_view_form;
24270
24266
 
24271
24267
  if (event_.shiftKey) {
24268
+ let i = 0;
24272
24269
  for (const other_view_form of this._view_forms) {
24273
- if (other_view_forms.record === this.record) {
24270
+ if (other_view_form.record === this.record) {
24274
24271
  current_view_form = other_view_form;
24275
24272
  break;
24276
24273
  }
24274
+ i++;
24277
24275
  }
24278
24276
  this.select_records(i, next_form_idx);
24279
24277
  } else {
@@ -25109,7 +25107,7 @@ function eval_pyson(value){
25109
25107
  record.modified_fields.id = added;
25110
25108
  }
25111
25109
  } else {
25112
- result = response_id != 'RESPONSE_CANCEL';
25110
+ result = (response_id != 'RESPONSE_CANCEL') && !readonly;
25113
25111
  }
25114
25112
  (cancel_prm || jQuery.when()).then(() => {
25115
25113
  if (this.callback) {
@@ -25982,18 +25980,21 @@ function eval_pyson(value){
25982
25980
  },
25983
25981
  sig_sel_add: function(el_field) {
25984
25982
  el_field = jQuery(el_field);
25985
- var field = el_field.attr('field');
25986
- var node = jQuery('<li/>', {
25983
+ this._add_node(el_field.attr('field'), el_field.attr('name'));
25984
+ },
25985
+ _add_node: function(field, name) {
25986
+ jQuery('<li/>', {
25987
25987
  'field': field,
25988
25988
  'class': 'draggable-handle',
25989
- }).text(el_field.attr('name')).prepend(
25989
+ }).text(name).prepend(
25990
25990
  Sao.common.ICONFACTORY.get_icon_img('tryton-drag')
25991
- ).click(function(e) {
25992
- if (e.ctrlKey || e.metaKey) {
25991
+ ).click(function(evt) {
25992
+ const node = jQuery(evt.target);
25993
+ if (evt.ctrlKey || evt.metaKey) {
25993
25994
  node.toggleClass('bg-primary');
25994
25995
  } else {
25995
- jQuery(e.target).addClass('bg-primary')
25996
- .siblings().removeClass('bg-primary');
25996
+ node.addClass('bg-primary');
25997
+ node.siblings().removeClass('bg-primary');
25997
25998
  }
25998
25999
  }).appendTo(this.fields_selected);
25999
26000
  },
@@ -26133,12 +26134,7 @@ function eval_pyson(value){
26133
26134
  Sao.i18n.gettext('Error'));
26134
26135
  return false;
26135
26136
  }
26136
- var node = jQuery('<li/>', {
26137
- 'field': field
26138
- }).text(name).click(() => {
26139
- node.addClass('bg-primary')
26140
- .siblings().removeClass('bg-primary');
26141
- }).appendTo(this.fields_selected);
26137
+ this._add_node(field, name);
26142
26138
  return true;
26143
26139
  },
26144
26140
  _traverse: function(fields, prefix, parents, i) {
@@ -9821,6 +9821,8 @@ img.icon {
9821
9821
  .form .form-hcontainer,
9822
9822
  .form .form-vcontainer {
9823
9823
  display: grid;
9824
+ width: 100%;
9825
+ height: 100%;
9824
9826
  }
9825
9827
  .form .form-item {
9826
9828
  display: flex;
@@ -9952,8 +9954,8 @@ img.icon {
9952
9954
  .form .form-richtext > textarea,
9953
9955
  .form .form-text .richtext,
9954
9956
  .form .form-richtext .richtext {
9957
+ height: 100%;
9955
9958
  line-height: 2.5ex;
9956
- max-height: 50ex;
9957
9959
  min-height: 12.5ex;
9958
9960
  overflow: auto;
9959
9961
  resize: vertical;