tryton-sao 7.4.4 → 7.4.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.4.6 - 2025-03-04
3
+ --------------------------
4
+ * Bug fixes (see mercurial logs for details)
5
+
6
+
7
+ Version 7.4.5 - 2025-02-16
8
+ --------------------------
9
+ * Bug fixes (see mercurial logs for details)
10
+
11
+
2
12
  Version 7.4.4 - 2025-01-16
3
13
  --------------------------
4
14
  * Bug fixes (see mercurial logs for details)
@@ -10100,6 +10100,16 @@ img.icon {
10100
10100
  .board .form-binary input {
10101
10101
  min-width: 12ch;
10102
10102
  }
10103
+ .form .form-many2one input[type='file'],
10104
+ .board .form-many2one input[type='file'],
10105
+ .form .form-one2one input[type='file'],
10106
+ .board .form-one2one input[type='file'],
10107
+ .form .form-reference input[type='file'],
10108
+ .board .form-reference input[type='file'],
10109
+ .form .form-binary input[type='file'],
10110
+ .board .form-binary input[type='file'] {
10111
+ min-width: unset;
10112
+ }
10103
10113
  @media screen and (min-width: 768px) {
10104
10114
  .form .form-reference > .input-sm,
10105
10115
  .board .form-reference > .input-sm,
@@ -3,7 +3,7 @@
3
3
 
4
4
  /* eslint-disable no-redeclare */
5
5
  var Sao = {
6
- __version__: '7.4.4',
6
+ __version__: '7.4.6',
7
7
  };
8
8
  /* eslint-enable no-redeclare */
9
9
 
@@ -8301,38 +8301,37 @@ var Sao = {
8301
8301
  var prm = jQuery.when();
8302
8302
  if ((this.id < 0) || this.modified) {
8303
8303
  var values = this.get();
8304
- if (this.id < 0) {
8305
- // synchronous call to avoid multiple creation
8306
- try {
8304
+ try {
8305
+ // synchronous call to avoid multiple creation or save
8306
+ if (this.id < 0) {
8307
8307
  this.id = this.model.execute(
8308
8308
  'create', [[values]], context, false)[0];
8309
- } catch (e) {
8310
- if (e.promise) {
8311
- return e.then(() => this.save(force_reload));
8312
- } else {
8313
- return jQuery.Deferred().reject();
8309
+
8310
+ } else {
8311
+ if (!jQuery.isEmptyObject(values)) {
8312
+ context._timestamp = this.get_timestamp();
8313
+ this.model.execute(
8314
+ 'write', [[this.id], values], context, false);
8314
8315
  }
8315
8316
  }
8316
- } else {
8317
- if (!jQuery.isEmptyObject(values)) {
8318
- context._timestamp = this.get_timestamp();
8319
- prm = this.model.execute('write', [[this.id], values],
8320
- context);
8317
+ } catch (e) {
8318
+ if (e.promise) {
8319
+ return e.then(() => this.save(force_reload));
8320
+ } else {
8321
+ return jQuery.Deferred().reject();
8321
8322
  }
8322
8323
  }
8323
- prm = prm.done(() => {
8324
- this.cancel();
8325
- if (force_reload) {
8326
- return this.reload();
8327
- }
8328
- });
8324
+ this.cancel();
8325
+ if (force_reload) {
8326
+ return this.reload();
8327
+ }
8329
8328
  if (this.group) {
8330
- prm = prm.done(() => this.group.written(this.id));
8329
+ prm = prm.then(() => this.group.written(this.id));
8331
8330
  }
8332
8331
  }
8333
8332
  if (this.group.parent) {
8334
8333
  delete this.group.parent.modified_fields[this.group.child_name];
8335
- prm = prm.done(() => this.group.parent.save(force_reload));
8334
+ prm = prm.then(() => this.group.parent.save(force_reload));
8336
8335
  }
8337
8336
  return prm;
8338
8337
  },
@@ -11559,7 +11558,7 @@ var Sao = {
11559
11558
  this.screen.save_tree_state();
11560
11559
  }
11561
11560
  var access = Sao.common.MODELACCESS.get(this.screen.model_name);
11562
- if (!(access.write || access.create)) {
11561
+ if (this.screen.readonly || !(access.write || access.create)) {
11563
11562
  return jQuery.Deferred().reject();
11564
11563
  }
11565
11564
  return this.screen.save_current().then(
@@ -11629,7 +11628,8 @@ var Sao = {
11629
11628
  });
11630
11629
  },
11631
11630
  delete_: function() {
11632
- if (!Sao.common.MODELACCESS.get(this.screen.model_name)['delete']) {
11631
+ if (!Sao.common.MODELACCESS.get(this.screen.model_name)['delete']
11632
+ || !this.screen.deletable) {
11633
11633
  return jQuery.when();
11634
11634
  }
11635
11635
  var msg;
@@ -14015,6 +14015,7 @@ var Sao = {
14015
14015
  },
14016
14016
  save_current: function() {
14017
14017
  var current_record = this.current_record;
14018
+ let new_record = current_record.id < 0;
14018
14019
  if (!current_record) {
14019
14020
  if (this.current_view &&
14020
14021
  (this.current_view.view_type == 'tree') &&
@@ -14052,6 +14053,9 @@ var Sao = {
14052
14053
  path.splice(-1, 1,
14053
14054
  [path[path.length - 1][0], current_record.id]);
14054
14055
  }
14056
+ if (new_record && this.switch_callback) {
14057
+ this.switch_callback();
14058
+ }
14055
14059
  return this.group.get_by_path(path).then(record => {
14056
14060
  this.current_record = record;
14057
14061
  });
@@ -14574,7 +14578,9 @@ var Sao = {
14574
14578
  }
14575
14579
  }
14576
14580
  }
14577
- if ((this.views.length == 1) && this.current_record) {
14581
+ }
14582
+ if ((view === this.current_view) && (view.view_type == 'form')) {
14583
+ if (this.current_record) {
14578
14584
  if (!(parent_ in this.tree_states)) {
14579
14585
  this.tree_states[parent_] = {};
14580
14586
  }
@@ -14590,11 +14596,13 @@ var Sao = {
14590
14596
  paths = [];
14591
14597
  }
14592
14598
  var selected_paths = view.get_selected_paths();
14593
- if (!(parent_ in this.tree_states)) {
14594
- this.tree_states[parent_] = {};
14599
+ if (view === this.current_view) {
14600
+ if (!(parent_ in this.tree_states)) {
14601
+ this.tree_states[parent_] = {};
14602
+ }
14603
+ this.tree_states[parent_][view.children_field || null] = [
14604
+ paths, selected_paths];
14595
14605
  }
14596
- this.tree_states[parent_][view.children_field || null] = [
14597
- paths, selected_paths];
14598
14606
  if (store && parseInt(view.attributes.tree_state, 10)) {
14599
14607
  var tree_state_model = new Sao.Model(
14600
14608
  'ir.ui.view_tree_state');
@@ -19468,10 +19476,14 @@ function eval_pyson(value){
19468
19476
  var editable = !this.text.prop('readonly');
19469
19477
  if (evt.which == Sao.common.F3_KEYCODE && editable) {
19470
19478
  evt.preventDefault();
19471
- this.new_();
19479
+ this.select();
19472
19480
  } else if (evt.which == Sao.common.F2_KEYCODE) {
19473
19481
  evt.preventDefault();
19474
- this.open();
19482
+ if (this.filename) {
19483
+ this.open();
19484
+ } else {
19485
+ this.save_as();
19486
+ }
19475
19487
  }
19476
19488
  },
19477
19489
  set_value: function() {
@@ -19484,7 +19496,7 @@ function eval_pyson(value){
19484
19496
  Sao.View.Form.Binary._super.set_readonly.call(this, readonly);
19485
19497
  var record = this.record;
19486
19498
  this.but_select.toggleClass('disabled', readonly || !record);
19487
- this.input_select.toggle(!readonly && record);
19499
+ this.input_select.toggle(!readonly && Boolean(record));
19488
19500
  this.but_clear.prop('disabled', readonly || !record);
19489
19501
  if (this.text) {
19490
19502
  this.text.prop('readonly', readonly);
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.4.4",
5
+ "version": "7.4.6",
6
6
  "homepage": "https://www.tryton.org/",
7
7
  "author": {
8
8
  "name": "Tryton"
package/src/model.js CHANGED
@@ -602,38 +602,37 @@
602
602
  var prm = jQuery.when();
603
603
  if ((this.id < 0) || this.modified) {
604
604
  var values = this.get();
605
- if (this.id < 0) {
606
- // synchronous call to avoid multiple creation
607
- try {
605
+ try {
606
+ // synchronous call to avoid multiple creation or save
607
+ if (this.id < 0) {
608
608
  this.id = this.model.execute(
609
609
  'create', [[values]], context, false)[0];
610
- } catch (e) {
611
- if (e.promise) {
612
- return e.then(() => this.save(force_reload));
613
- } else {
614
- return jQuery.Deferred().reject();
610
+
611
+ } else {
612
+ if (!jQuery.isEmptyObject(values)) {
613
+ context._timestamp = this.get_timestamp();
614
+ this.model.execute(
615
+ 'write', [[this.id], values], context, false);
615
616
  }
616
617
  }
617
- } else {
618
- if (!jQuery.isEmptyObject(values)) {
619
- context._timestamp = this.get_timestamp();
620
- prm = this.model.execute('write', [[this.id], values],
621
- context);
618
+ } catch (e) {
619
+ if (e.promise) {
620
+ return e.then(() => this.save(force_reload));
621
+ } else {
622
+ return jQuery.Deferred().reject();
622
623
  }
623
624
  }
624
- prm = prm.done(() => {
625
- this.cancel();
626
- if (force_reload) {
627
- return this.reload();
628
- }
629
- });
625
+ this.cancel();
626
+ if (force_reload) {
627
+ return this.reload();
628
+ }
630
629
  if (this.group) {
631
- prm = prm.done(() => this.group.written(this.id));
630
+ prm = prm.then(() => this.group.written(this.id));
632
631
  }
633
632
  }
634
633
  if (this.group.parent) {
635
634
  delete this.group.parent.modified_fields[this.group.child_name];
636
- prm = prm.done(() => this.group.parent.save(force_reload));
635
+ prm = prm.then(() => this.group.parent.save(force_reload));
637
636
  }
638
637
  return prm;
639
638
  },
package/src/sao.js CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  /* eslint-disable no-redeclare */
5
5
  var Sao = {
6
- __version__: '7.4.4',
6
+ __version__: '7.4.6',
7
7
  };
8
8
  /* eslint-enable no-redeclare */
9
9
 
package/src/sao.less CHANGED
@@ -877,6 +877,10 @@ img.icon {
877
877
  }
878
878
  input {
879
879
  min-width: 12ch;
880
+
881
+ &[type='file'] {
882
+ min-width: unset;
883
+ }
880
884
  }
881
885
  }
882
886
 
package/src/screen.js CHANGED
@@ -1606,6 +1606,7 @@
1606
1606
  },
1607
1607
  save_current: function() {
1608
1608
  var current_record = this.current_record;
1609
+ let new_record = current_record.id < 0;
1609
1610
  if (!current_record) {
1610
1611
  if (this.current_view &&
1611
1612
  (this.current_view.view_type == 'tree') &&
@@ -1643,6 +1644,9 @@
1643
1644
  path.splice(-1, 1,
1644
1645
  [path[path.length - 1][0], current_record.id]);
1645
1646
  }
1647
+ if (new_record && this.switch_callback) {
1648
+ this.switch_callback();
1649
+ }
1646
1650
  return this.group.get_by_path(path).then(record => {
1647
1651
  this.current_record = record;
1648
1652
  });
@@ -2165,7 +2169,9 @@
2165
2169
  }
2166
2170
  }
2167
2171
  }
2168
- if ((this.views.length == 1) && this.current_record) {
2172
+ }
2173
+ if ((view === this.current_view) && (view.view_type == 'form')) {
2174
+ if (this.current_record) {
2169
2175
  if (!(parent_ in this.tree_states)) {
2170
2176
  this.tree_states[parent_] = {};
2171
2177
  }
@@ -2181,11 +2187,13 @@
2181
2187
  paths = [];
2182
2188
  }
2183
2189
  var selected_paths = view.get_selected_paths();
2184
- if (!(parent_ in this.tree_states)) {
2185
- this.tree_states[parent_] = {};
2190
+ if (view === this.current_view) {
2191
+ if (!(parent_ in this.tree_states)) {
2192
+ this.tree_states[parent_] = {};
2193
+ }
2194
+ this.tree_states[parent_][view.children_field || null] = [
2195
+ paths, selected_paths];
2186
2196
  }
2187
- this.tree_states[parent_][view.children_field || null] = [
2188
- paths, selected_paths];
2189
2197
  if (store && parseInt(view.attributes.tree_state, 10)) {
2190
2198
  var tree_state_model = new Sao.Model(
2191
2199
  'ir.ui.view_tree_state');
package/src/tab.js CHANGED
@@ -877,7 +877,7 @@
877
877
  this.screen.save_tree_state();
878
878
  }
879
879
  var access = Sao.common.MODELACCESS.get(this.screen.model_name);
880
- if (!(access.write || access.create)) {
880
+ if (this.screen.readonly || !(access.write || access.create)) {
881
881
  return jQuery.Deferred().reject();
882
882
  }
883
883
  return this.screen.save_current().then(
@@ -947,7 +947,8 @@
947
947
  });
948
948
  },
949
949
  delete_: function() {
950
- if (!Sao.common.MODELACCESS.get(this.screen.model_name)['delete']) {
950
+ if (!Sao.common.MODELACCESS.get(this.screen.model_name)['delete']
951
+ || !this.screen.deletable) {
951
952
  return jQuery.when();
952
953
  }
953
954
  var msg;
package/src/view/form.js CHANGED
@@ -4589,10 +4589,14 @@ function eval_pyson(value){
4589
4589
  var editable = !this.text.prop('readonly');
4590
4590
  if (evt.which == Sao.common.F3_KEYCODE && editable) {
4591
4591
  evt.preventDefault();
4592
- this.new_();
4592
+ this.select();
4593
4593
  } else if (evt.which == Sao.common.F2_KEYCODE) {
4594
4594
  evt.preventDefault();
4595
- this.open();
4595
+ if (this.filename) {
4596
+ this.open();
4597
+ } else {
4598
+ this.save_as();
4599
+ }
4596
4600
  }
4597
4601
  },
4598
4602
  set_value: function() {
@@ -4605,7 +4609,7 @@ function eval_pyson(value){
4605
4609
  Sao.View.Form.Binary._super.set_readonly.call(this, readonly);
4606
4610
  var record = this.record;
4607
4611
  this.but_select.toggleClass('disabled', readonly || !record);
4608
- this.input_select.toggle(!readonly && record);
4612
+ this.input_select.toggle(!readonly && Boolean(record));
4609
4613
  this.but_clear.prop('disabled', readonly || !record);
4610
4614
  if (this.text) {
4611
4615
  this.text.prop('readonly', readonly);