tryton-sao 7.2.14 → 7.2.16

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.16 - 2025-03-04
3
+ ---------------------------
4
+ * Bug fixes (see mercurial logs for details)
5
+
6
+
7
+ Version 7.2.15 - 2025-02-16
8
+ ---------------------------
9
+ * Bug fixes (see mercurial logs for details)
10
+
11
+
2
12
  Version 7.2.14 - 2025-01-16
3
13
  ---------------------------
4
14
  * Bug fixes (see mercurial logs for details)
@@ -10032,6 +10032,16 @@ img.icon {
10032
10032
  .board .form-binary input {
10033
10033
  min-width: 12ch;
10034
10034
  }
10035
+ .form .form-many2one input[type='file'],
10036
+ .board .form-many2one input[type='file'],
10037
+ .form .form-one2one input[type='file'],
10038
+ .board .form-one2one input[type='file'],
10039
+ .form .form-reference input[type='file'],
10040
+ .board .form-reference input[type='file'],
10041
+ .form .form-binary input[type='file'],
10042
+ .board .form-binary input[type='file'] {
10043
+ min-width: unset;
10044
+ }
10035
10045
  @media screen and (min-width: 768px) {
10036
10046
  .form .form-reference > .input-sm,
10037
10047
  .board .form-reference > .input-sm,
@@ -3,7 +3,7 @@
3
3
 
4
4
  /* eslint-disable no-redeclare */
5
5
  var Sao = {
6
- __version__: '7.2.14',
6
+ __version__: '7.2.16',
7
7
  };
8
8
  /* eslint-enable no-redeclare */
9
9
 
@@ -8254,38 +8254,37 @@ var Sao = {
8254
8254
  var prm = jQuery.when();
8255
8255
  if ((this.id < 0) || this.modified) {
8256
8256
  var values = this.get();
8257
- if (this.id < 0) {
8258
- // synchronous call to avoid multiple creation
8259
- try {
8257
+ try {
8258
+ // synchronous call to avoid multiple creation or save
8259
+ if (this.id < 0) {
8260
8260
  this.id = this.model.execute(
8261
8261
  'create', [[values]], context, false)[0];
8262
- } catch (e) {
8263
- if (e.promise) {
8264
- return e.then(() => this.save(force_reload));
8265
- } else {
8266
- return jQuery.Deferred().reject();
8262
+
8263
+ } else {
8264
+ if (!jQuery.isEmptyObject(values)) {
8265
+ context._timestamp = this.get_timestamp();
8266
+ this.model.execute(
8267
+ 'write', [[this.id], values], context, false);
8267
8268
  }
8268
8269
  }
8269
- } else {
8270
- if (!jQuery.isEmptyObject(values)) {
8271
- context._timestamp = this.get_timestamp();
8272
- prm = this.model.execute('write', [[this.id], values],
8273
- context);
8270
+ } catch (e) {
8271
+ if (e.promise) {
8272
+ return e.then(() => this.save(force_reload));
8273
+ } else {
8274
+ return jQuery.Deferred().reject();
8274
8275
  }
8275
8276
  }
8276
- prm = prm.done(() => {
8277
- this.cancel();
8278
- if (force_reload) {
8279
- return this.reload();
8280
- }
8281
- });
8277
+ this.cancel();
8278
+ if (force_reload) {
8279
+ return this.reload();
8280
+ }
8282
8281
  if (this.group) {
8283
- prm = prm.done(() => this.group.written(this.id));
8282
+ prm = prm.then(() => this.group.written(this.id));
8284
8283
  }
8285
8284
  }
8286
8285
  if (this.group.parent) {
8287
8286
  delete this.group.parent.modified_fields[this.group.child_name];
8288
- prm = prm.done(() => this.group.parent.save(force_reload));
8287
+ prm = prm.then(() => this.group.parent.save(force_reload));
8289
8288
  }
8290
8289
  return prm;
8291
8290
  },
@@ -11538,7 +11537,7 @@ var Sao = {
11538
11537
  this.screen.save_tree_state();
11539
11538
  }
11540
11539
  var access = Sao.common.MODELACCESS.get(this.screen.model_name);
11541
- if (!(access.write || access.create)) {
11540
+ if (this.screen.readonly || !(access.write || access.create)) {
11542
11541
  return jQuery.Deferred().reject();
11543
11542
  }
11544
11543
  return this.screen.save_current().then(
@@ -11608,7 +11607,8 @@ var Sao = {
11608
11607
  });
11609
11608
  },
11610
11609
  delete_: function() {
11611
- if (!Sao.common.MODELACCESS.get(this.screen.model_name)['delete']) {
11610
+ if (!Sao.common.MODELACCESS.get(this.screen.model_name)['delete']
11611
+ || !this.screen.deletable) {
11612
11612
  return jQuery.when();
11613
11613
  }
11614
11614
  var msg;
@@ -13979,6 +13979,7 @@ var Sao = {
13979
13979
  },
13980
13980
  save_current: function() {
13981
13981
  var current_record = this.current_record;
13982
+ let new_record = current_record.id < 0;
13982
13983
  if (!current_record) {
13983
13984
  if (this.current_view &&
13984
13985
  (this.current_view.view_type == 'tree') &&
@@ -14016,6 +14017,9 @@ var Sao = {
14016
14017
  path.splice(-1, 1,
14017
14018
  [path[path.length - 1][0], current_record.id]);
14018
14019
  }
14020
+ if (new_record && this.switch_callback) {
14021
+ this.switch_callback();
14022
+ }
14019
14023
  return this.group.get_by_path(path).then(record => {
14020
14024
  this.current_record = record;
14021
14025
  });
@@ -14546,7 +14550,9 @@ var Sao = {
14546
14550
  }
14547
14551
  }
14548
14552
  }
14549
- if ((this.views.length == 1) && this.current_record) {
14553
+ }
14554
+ if ((view === this.current_view) && (view.view_type == 'form')) {
14555
+ if (this.current_record) {
14550
14556
  if (!(parent_ in this.tree_states)) {
14551
14557
  this.tree_states[parent_] = {};
14552
14558
  }
@@ -14562,11 +14568,13 @@ var Sao = {
14562
14568
  paths = [];
14563
14569
  }
14564
14570
  var selected_paths = view.get_selected_paths();
14565
- if (!(parent_ in this.tree_states)) {
14566
- this.tree_states[parent_] = {};
14571
+ if (view === this.current_view) {
14572
+ if (!(parent_ in this.tree_states)) {
14573
+ this.tree_states[parent_] = {};
14574
+ }
14575
+ this.tree_states[parent_][view.children_field || null] = [
14576
+ paths, selected_paths];
14567
14577
  }
14568
- this.tree_states[parent_][view.children_field || null] = [
14569
- paths, selected_paths];
14570
14578
  if (store && parseInt(view.attributes.tree_state, 10)) {
14571
14579
  var tree_state_model = new Sao.Model(
14572
14580
  'ir.ui.view_tree_state');
@@ -19343,10 +19351,14 @@ function eval_pyson(value){
19343
19351
  var editable = !this.text.prop('readonly');
19344
19352
  if (evt.which == Sao.common.F3_KEYCODE && editable) {
19345
19353
  evt.preventDefault();
19346
- this.new_();
19354
+ this.select();
19347
19355
  } else if (evt.which == Sao.common.F2_KEYCODE) {
19348
19356
  evt.preventDefault();
19349
- this.open();
19357
+ if (this.filename) {
19358
+ this.open();
19359
+ } else {
19360
+ this.save_as();
19361
+ }
19350
19362
  }
19351
19363
  },
19352
19364
  set_value: function() {
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.14",
5
+ "version": "7.2.16",
6
6
  "homepage": "http://www.tryton.org/",
7
7
  "author": {
8
8
  "name": "Tryton"
package/src/model.js CHANGED
@@ -599,38 +599,37 @@
599
599
  var prm = jQuery.when();
600
600
  if ((this.id < 0) || this.modified) {
601
601
  var values = this.get();
602
- if (this.id < 0) {
603
- // synchronous call to avoid multiple creation
604
- try {
602
+ try {
603
+ // synchronous call to avoid multiple creation or save
604
+ if (this.id < 0) {
605
605
  this.id = this.model.execute(
606
606
  'create', [[values]], context, false)[0];
607
- } catch (e) {
608
- if (e.promise) {
609
- return e.then(() => this.save(force_reload));
610
- } else {
611
- return jQuery.Deferred().reject();
607
+
608
+ } else {
609
+ if (!jQuery.isEmptyObject(values)) {
610
+ context._timestamp = this.get_timestamp();
611
+ this.model.execute(
612
+ 'write', [[this.id], values], context, false);
612
613
  }
613
614
  }
614
- } else {
615
- if (!jQuery.isEmptyObject(values)) {
616
- context._timestamp = this.get_timestamp();
617
- prm = this.model.execute('write', [[this.id], values],
618
- context);
615
+ } catch (e) {
616
+ if (e.promise) {
617
+ return e.then(() => this.save(force_reload));
618
+ } else {
619
+ return jQuery.Deferred().reject();
619
620
  }
620
621
  }
621
- prm = prm.done(() => {
622
- this.cancel();
623
- if (force_reload) {
624
- return this.reload();
625
- }
626
- });
622
+ this.cancel();
623
+ if (force_reload) {
624
+ return this.reload();
625
+ }
627
626
  if (this.group) {
628
- prm = prm.done(() => this.group.written(this.id));
627
+ prm = prm.then(() => this.group.written(this.id));
629
628
  }
630
629
  }
631
630
  if (this.group.parent) {
632
631
  delete this.group.parent.modified_fields[this.group.child_name];
633
- prm = prm.done(() => this.group.parent.save(force_reload));
632
+ prm = prm.then(() => this.group.parent.save(force_reload));
634
633
  }
635
634
  return prm;
636
635
  },
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.14',
6
+ __version__: '7.2.16',
7
7
  };
8
8
  /* eslint-enable no-redeclare */
9
9
 
package/src/sao.less CHANGED
@@ -806,6 +806,10 @@ img.icon {
806
806
  }
807
807
  input {
808
808
  min-width: 12ch;
809
+
810
+ &[type='file'] {
811
+ min-width: unset;
812
+ }
809
813
  }
810
814
  }
811
815
 
package/src/screen.js CHANGED
@@ -1597,6 +1597,7 @@
1597
1597
  },
1598
1598
  save_current: function() {
1599
1599
  var current_record = this.current_record;
1600
+ let new_record = current_record.id < 0;
1600
1601
  if (!current_record) {
1601
1602
  if (this.current_view &&
1602
1603
  (this.current_view.view_type == 'tree') &&
@@ -1634,6 +1635,9 @@
1634
1635
  path.splice(-1, 1,
1635
1636
  [path[path.length - 1][0], current_record.id]);
1636
1637
  }
1638
+ if (new_record && this.switch_callback) {
1639
+ this.switch_callback();
1640
+ }
1637
1641
  return this.group.get_by_path(path).then(record => {
1638
1642
  this.current_record = record;
1639
1643
  });
@@ -2164,7 +2168,9 @@
2164
2168
  }
2165
2169
  }
2166
2170
  }
2167
- if ((this.views.length == 1) && this.current_record) {
2171
+ }
2172
+ if ((view === this.current_view) && (view.view_type == 'form')) {
2173
+ if (this.current_record) {
2168
2174
  if (!(parent_ in this.tree_states)) {
2169
2175
  this.tree_states[parent_] = {};
2170
2176
  }
@@ -2180,11 +2186,13 @@
2180
2186
  paths = [];
2181
2187
  }
2182
2188
  var selected_paths = view.get_selected_paths();
2183
- if (!(parent_ in this.tree_states)) {
2184
- this.tree_states[parent_] = {};
2189
+ if (view === this.current_view) {
2190
+ if (!(parent_ in this.tree_states)) {
2191
+ this.tree_states[parent_] = {};
2192
+ }
2193
+ this.tree_states[parent_][view.children_field || null] = [
2194
+ paths, selected_paths];
2185
2195
  }
2186
- this.tree_states[parent_][view.children_field || null] = [
2187
- paths, selected_paths];
2188
2196
  if (store && parseInt(view.attributes.tree_state, 10)) {
2189
2197
  var tree_state_model = new Sao.Model(
2190
2198
  'ir.ui.view_tree_state');
package/src/tab.js CHANGED
@@ -872,7 +872,7 @@
872
872
  this.screen.save_tree_state();
873
873
  }
874
874
  var access = Sao.common.MODELACCESS.get(this.screen.model_name);
875
- if (!(access.write || access.create)) {
875
+ if (this.screen.readonly || !(access.write || access.create)) {
876
876
  return jQuery.Deferred().reject();
877
877
  }
878
878
  return this.screen.save_current().then(
@@ -942,7 +942,8 @@
942
942
  });
943
943
  },
944
944
  delete_: function() {
945
- if (!Sao.common.MODELACCESS.get(this.screen.model_name)['delete']) {
945
+ if (!Sao.common.MODELACCESS.get(this.screen.model_name)['delete']
946
+ || !this.screen.deletable) {
946
947
  return jQuery.when();
947
948
  }
948
949
  var msg;
package/src/view/form.js CHANGED
@@ -4492,10 +4492,14 @@ function eval_pyson(value){
4492
4492
  var editable = !this.text.prop('readonly');
4493
4493
  if (evt.which == Sao.common.F3_KEYCODE && editable) {
4494
4494
  evt.preventDefault();
4495
- this.new_();
4495
+ this.select();
4496
4496
  } else if (evt.which == Sao.common.F2_KEYCODE) {
4497
4497
  evt.preventDefault();
4498
- this.open();
4498
+ if (this.filename) {
4499
+ this.open();
4500
+ } else {
4501
+ this.save_as();
4502
+ }
4499
4503
  }
4500
4504
  },
4501
4505
  set_value: function() {