tryton-sao 7.2.17 → 7.2.19
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 +10 -0
- package/dist/tryton-sao.css +3 -0
- package/dist/tryton-sao.js +39 -30
- package/package.json +1 -1
- package/src/common.js +1 -1
- package/src/model.js +20 -23
- package/src/sao.js +1 -1
- package/src/sao.less +3 -0
- package/src/screen.js +12 -2
- package/src/tab.js +4 -1
- package/src/view/form.js +1 -2
package/CHANGELOG
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
|
|
2
|
+
Version 7.2.19 - 2025-04-26
|
|
3
|
+
---------------------------
|
|
4
|
+
* Bug fixes (see mercurial logs for details)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Version 7.2.18 - 2025-04-02
|
|
8
|
+
---------------------------
|
|
9
|
+
* Bug fixes (see mercurial logs for details)
|
|
10
|
+
|
|
11
|
+
|
|
2
12
|
Version 7.2.17 - 2025-03-15
|
|
3
13
|
---------------------------
|
|
4
14
|
* Bug fixes (see mercurial logs for details)
|
package/dist/tryton-sao.css
CHANGED
|
@@ -10456,6 +10456,9 @@ input.column-boolean {
|
|
|
10456
10456
|
float: none;
|
|
10457
10457
|
}
|
|
10458
10458
|
@media screen and (max-width: 767px) {
|
|
10459
|
+
.form-dict-container {
|
|
10460
|
+
grid-template-columns: 100%;
|
|
10461
|
+
}
|
|
10459
10462
|
.dict-row {
|
|
10460
10463
|
grid-column: 1;
|
|
10461
10464
|
}
|
package/dist/tryton-sao.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
/* eslint-disable no-redeclare */
|
|
5
5
|
var Sao = {
|
|
6
|
-
__version__: '7.2.
|
|
6
|
+
__version__: '7.2.19',
|
|
7
7
|
};
|
|
8
8
|
/* eslint-enable no-redeclare */
|
|
9
9
|
|
|
@@ -4124,7 +4124,7 @@ var Sao = {
|
|
|
4124
4124
|
});
|
|
4125
4125
|
}
|
|
4126
4126
|
};
|
|
4127
|
-
this._selection_prm.
|
|
4127
|
+
this._selection_prm.always(_update_selection);
|
|
4128
4128
|
};
|
|
4129
4129
|
Sao.common.selection_mixin.filter_selection = function(
|
|
4130
4130
|
domain, record, field) {
|
|
@@ -7659,7 +7659,7 @@ var Sao = {
|
|
|
7659
7659
|
'use strict';
|
|
7660
7660
|
|
|
7661
7661
|
function get_x2m_sub_fields(f_attrs, prefix) {
|
|
7662
|
-
if (f_attrs.visible && f_attrs.views) {
|
|
7662
|
+
if (f_attrs.visible && !jQuery.isEmptyObject(f_attrs.views)) {
|
|
7663
7663
|
// There's only one key but we don't know its value
|
|
7664
7664
|
const [[, view],] = Object.entries(f_attrs.views);
|
|
7665
7665
|
|
|
@@ -8238,6 +8238,7 @@ var Sao = {
|
|
|
8238
8238
|
this.autocompletion = {};
|
|
8239
8239
|
this.exception = false;
|
|
8240
8240
|
this.destroyed = false;
|
|
8241
|
+
this._save_prm = jQuery.when();
|
|
8241
8242
|
},
|
|
8242
8243
|
get modified() {
|
|
8243
8244
|
if (!jQuery.isEmptyObject(this.modified_fields)) {
|
|
@@ -8251,33 +8252,28 @@ var Sao = {
|
|
|
8251
8252
|
},
|
|
8252
8253
|
save: function(force_reload=false) {
|
|
8253
8254
|
var context = this.get_context();
|
|
8255
|
+
if (this._save_prm.state() == 'pending') {
|
|
8256
|
+
return this._save_prm.then(() => this.save(force_reload));
|
|
8257
|
+
}
|
|
8254
8258
|
var prm = jQuery.when();
|
|
8255
8259
|
if ((this.id < 0) || this.modified) {
|
|
8256
8260
|
var values = this.get();
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8265
|
-
context._timestamp = this.get_timestamp();
|
|
8266
|
-
this.model.execute(
|
|
8267
|
-
'write', [[this.id], values], context, false);
|
|
8268
|
-
}
|
|
8269
|
-
}
|
|
8270
|
-
} catch (e) {
|
|
8271
|
-
if (e.promise) {
|
|
8272
|
-
return e.then(() => this.save(force_reload));
|
|
8273
|
-
} else {
|
|
8274
|
-
return jQuery.Deferred().reject();
|
|
8261
|
+
if (this.id < 0) {
|
|
8262
|
+
prm = this.model.execute('create', [[values]], context)
|
|
8263
|
+
.then(ids => this.id = ids[0]);
|
|
8264
|
+
} else {
|
|
8265
|
+
if (!jQuery.isEmptyObject(values)) {
|
|
8266
|
+
context._timestamp = this.get_timestamp();
|
|
8267
|
+
prm = this.model.execute(
|
|
8268
|
+
'write', [[this.id], values], context);
|
|
8275
8269
|
}
|
|
8276
8270
|
}
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
8271
|
+
prm = prm.then(() => {
|
|
8272
|
+
this.cancel();
|
|
8273
|
+
if (force_reload) {
|
|
8274
|
+
return this.reload();
|
|
8275
|
+
}
|
|
8276
|
+
});
|
|
8281
8277
|
if (this.group) {
|
|
8282
8278
|
prm = prm.then(() => this.group.written(this.id));
|
|
8283
8279
|
}
|
|
@@ -8286,6 +8282,7 @@ var Sao = {
|
|
|
8286
8282
|
delete this.group.parent.modified_fields[this.group.child_name];
|
|
8287
8283
|
prm = prm.then(() => this.group.parent.save(force_reload));
|
|
8288
8284
|
}
|
|
8285
|
+
this._save_prm = prm;
|
|
8289
8286
|
return prm;
|
|
8290
8287
|
},
|
|
8291
8288
|
reload: function(fields, async=true) {
|
|
@@ -12161,6 +12158,7 @@ var Sao = {
|
|
|
12161
12158
|
}
|
|
12162
12159
|
}
|
|
12163
12160
|
const view_type = this.screen.current_view.view_type;
|
|
12161
|
+
var next_view_type = this.screen.next_view_type;
|
|
12164
12162
|
const has_views = this.screen.number_of_views > 1;
|
|
12165
12163
|
var buttons = ['print', 'relate', 'email', 'attach'];
|
|
12166
12164
|
for (const button_id of buttons) {
|
|
@@ -12181,7 +12179,9 @@ var Sao = {
|
|
|
12181
12179
|
set_sensitive(button_id, position && can_be_sensitive);
|
|
12182
12180
|
}
|
|
12183
12181
|
set_sensitive(
|
|
12184
|
-
'switch_',
|
|
12182
|
+
'switch_',
|
|
12183
|
+
(position || (view_type == 'form') || (next_view_type != 'form')) &&
|
|
12184
|
+
has_views);
|
|
12185
12185
|
set_sensitive('delete_', this.screen.deletable);
|
|
12186
12186
|
set_sensitive('previous', this.screen.has_previous());
|
|
12187
12187
|
set_sensitive('next', this.screen.has_next());
|
|
@@ -13309,6 +13309,15 @@ var Sao = {
|
|
|
13309
13309
|
get view_index() {
|
|
13310
13310
|
return this.views.indexOf(this.current_view);
|
|
13311
13311
|
},
|
|
13312
|
+
get next_view_type() {
|
|
13313
|
+
var views = this.views.concat(this.view_to_load)
|
|
13314
|
+
var next_view_index = (this.view_index + 1) % views.length;
|
|
13315
|
+
var next_view = views[next_view_index];
|
|
13316
|
+
if (typeof next_view != 'string') {
|
|
13317
|
+
next_view = next_view.view_type;
|
|
13318
|
+
}
|
|
13319
|
+
return next_view;
|
|
13320
|
+
},
|
|
13312
13321
|
switch_view: function(
|
|
13313
13322
|
view_type=null, view_id=null, creatable=null, display=true) {
|
|
13314
13323
|
if (view_id !== null) {
|
|
@@ -13979,7 +13988,6 @@ var Sao = {
|
|
|
13979
13988
|
},
|
|
13980
13989
|
save_current: function() {
|
|
13981
13990
|
var current_record = this.current_record;
|
|
13982
|
-
let new_record = current_record.id < 0;
|
|
13983
13991
|
if (!current_record) {
|
|
13984
13992
|
if (this.current_view &&
|
|
13985
13993
|
(this.current_view.view_type == 'tree') &&
|
|
@@ -13990,6 +13998,7 @@ var Sao = {
|
|
|
13990
13998
|
return jQuery.when();
|
|
13991
13999
|
}
|
|
13992
14000
|
}
|
|
14001
|
+
let new_record = current_record.id < 0;
|
|
13993
14002
|
if (this.current_view) {
|
|
13994
14003
|
this.current_view.set_value();
|
|
13995
14004
|
var fields = this.current_view.get_fields();
|
|
@@ -14668,7 +14677,8 @@ var Sao = {
|
|
|
14668
14677
|
return view.display(selected_nodes);
|
|
14669
14678
|
} else {
|
|
14670
14679
|
var record;
|
|
14671
|
-
if (!jQuery.isEmptyObject(selected_nodes)
|
|
14680
|
+
if (!jQuery.isEmptyObject(selected_nodes) &&
|
|
14681
|
+
!this.current_record) {
|
|
14672
14682
|
for (const id of selected_nodes[0]) {
|
|
14673
14683
|
const new_record = this.group.get(id);
|
|
14674
14684
|
if (!new_record) {
|
|
@@ -20427,8 +20437,7 @@ function eval_pyson(value){
|
|
|
20427
20437
|
return this._parse(this.format, this.input.val());
|
|
20428
20438
|
},
|
|
20429
20439
|
set_value: function(value) {
|
|
20430
|
-
if ((value
|
|
20431
|
-
(value instanceof Sao.Date)) {
|
|
20440
|
+
if (value && (value.isDate || value.isDateTime)) {
|
|
20432
20441
|
value = this._format(this.format, value);
|
|
20433
20442
|
} else {
|
|
20434
20443
|
value = '';
|
package/package.json
CHANGED
package/src/common.js
CHANGED
package/src/model.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
6
|
function get_x2m_sub_fields(f_attrs, prefix) {
|
|
7
|
-
if (f_attrs.visible && f_attrs.views) {
|
|
7
|
+
if (f_attrs.visible && !jQuery.isEmptyObject(f_attrs.views)) {
|
|
8
8
|
// There's only one key but we don't know its value
|
|
9
9
|
const [[, view],] = Object.entries(f_attrs.views);
|
|
10
10
|
|
|
@@ -583,6 +583,7 @@
|
|
|
583
583
|
this.autocompletion = {};
|
|
584
584
|
this.exception = false;
|
|
585
585
|
this.destroyed = false;
|
|
586
|
+
this._save_prm = jQuery.when();
|
|
586
587
|
},
|
|
587
588
|
get modified() {
|
|
588
589
|
if (!jQuery.isEmptyObject(this.modified_fields)) {
|
|
@@ -596,33 +597,28 @@
|
|
|
596
597
|
},
|
|
597
598
|
save: function(force_reload=false) {
|
|
598
599
|
var context = this.get_context();
|
|
600
|
+
if (this._save_prm.state() == 'pending') {
|
|
601
|
+
return this._save_prm.then(() => this.save(force_reload));
|
|
602
|
+
}
|
|
599
603
|
var prm = jQuery.when();
|
|
600
604
|
if ((this.id < 0) || this.modified) {
|
|
601
605
|
var values = this.get();
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
context._timestamp = this.get_timestamp();
|
|
611
|
-
this.model.execute(
|
|
612
|
-
'write', [[this.id], values], context, false);
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
} catch (e) {
|
|
616
|
-
if (e.promise) {
|
|
617
|
-
return e.then(() => this.save(force_reload));
|
|
618
|
-
} else {
|
|
619
|
-
return jQuery.Deferred().reject();
|
|
606
|
+
if (this.id < 0) {
|
|
607
|
+
prm = this.model.execute('create', [[values]], context)
|
|
608
|
+
.then(ids => this.id = ids[0]);
|
|
609
|
+
} else {
|
|
610
|
+
if (!jQuery.isEmptyObject(values)) {
|
|
611
|
+
context._timestamp = this.get_timestamp();
|
|
612
|
+
prm = this.model.execute(
|
|
613
|
+
'write', [[this.id], values], context);
|
|
620
614
|
}
|
|
621
615
|
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
616
|
+
prm = prm.then(() => {
|
|
617
|
+
this.cancel();
|
|
618
|
+
if (force_reload) {
|
|
619
|
+
return this.reload();
|
|
620
|
+
}
|
|
621
|
+
});
|
|
626
622
|
if (this.group) {
|
|
627
623
|
prm = prm.then(() => this.group.written(this.id));
|
|
628
624
|
}
|
|
@@ -631,6 +627,7 @@
|
|
|
631
627
|
delete this.group.parent.modified_fields[this.group.child_name];
|
|
632
628
|
prm = prm.then(() => this.group.parent.save(force_reload));
|
|
633
629
|
}
|
|
630
|
+
this._save_prm = prm;
|
|
634
631
|
return prm;
|
|
635
632
|
},
|
|
636
633
|
reload: function(fields, async=true) {
|
package/src/sao.js
CHANGED
package/src/sao.less
CHANGED
package/src/screen.js
CHANGED
|
@@ -927,6 +927,15 @@
|
|
|
927
927
|
get view_index() {
|
|
928
928
|
return this.views.indexOf(this.current_view);
|
|
929
929
|
},
|
|
930
|
+
get next_view_type() {
|
|
931
|
+
var views = this.views.concat(this.view_to_load)
|
|
932
|
+
var next_view_index = (this.view_index + 1) % views.length;
|
|
933
|
+
var next_view = views[next_view_index];
|
|
934
|
+
if (typeof next_view != 'string') {
|
|
935
|
+
next_view = next_view.view_type;
|
|
936
|
+
}
|
|
937
|
+
return next_view;
|
|
938
|
+
},
|
|
930
939
|
switch_view: function(
|
|
931
940
|
view_type=null, view_id=null, creatable=null, display=true) {
|
|
932
941
|
if (view_id !== null) {
|
|
@@ -1597,7 +1606,6 @@
|
|
|
1597
1606
|
},
|
|
1598
1607
|
save_current: function() {
|
|
1599
1608
|
var current_record = this.current_record;
|
|
1600
|
-
let new_record = current_record.id < 0;
|
|
1601
1609
|
if (!current_record) {
|
|
1602
1610
|
if (this.current_view &&
|
|
1603
1611
|
(this.current_view.view_type == 'tree') &&
|
|
@@ -1608,6 +1616,7 @@
|
|
|
1608
1616
|
return jQuery.when();
|
|
1609
1617
|
}
|
|
1610
1618
|
}
|
|
1619
|
+
let new_record = current_record.id < 0;
|
|
1611
1620
|
if (this.current_view) {
|
|
1612
1621
|
this.current_view.set_value();
|
|
1613
1622
|
var fields = this.current_view.get_fields();
|
|
@@ -2286,7 +2295,8 @@
|
|
|
2286
2295
|
return view.display(selected_nodes);
|
|
2287
2296
|
} else {
|
|
2288
2297
|
var record;
|
|
2289
|
-
if (!jQuery.isEmptyObject(selected_nodes)
|
|
2298
|
+
if (!jQuery.isEmptyObject(selected_nodes) &&
|
|
2299
|
+
!this.current_record) {
|
|
2290
2300
|
for (const id of selected_nodes[0]) {
|
|
2291
2301
|
const new_record = this.group.get(id);
|
|
2292
2302
|
if (!new_record) {
|
package/src/tab.js
CHANGED
|
@@ -1496,6 +1496,7 @@
|
|
|
1496
1496
|
}
|
|
1497
1497
|
}
|
|
1498
1498
|
const view_type = this.screen.current_view.view_type;
|
|
1499
|
+
var next_view_type = this.screen.next_view_type;
|
|
1499
1500
|
const has_views = this.screen.number_of_views > 1;
|
|
1500
1501
|
var buttons = ['print', 'relate', 'email', 'attach'];
|
|
1501
1502
|
for (const button_id of buttons) {
|
|
@@ -1516,7 +1517,9 @@
|
|
|
1516
1517
|
set_sensitive(button_id, position && can_be_sensitive);
|
|
1517
1518
|
}
|
|
1518
1519
|
set_sensitive(
|
|
1519
|
-
'switch_',
|
|
1520
|
+
'switch_',
|
|
1521
|
+
(position || (view_type == 'form') || (next_view_type != 'form')) &&
|
|
1522
|
+
has_views);
|
|
1520
1523
|
set_sensitive('delete_', this.screen.deletable);
|
|
1521
1524
|
set_sensitive('previous', this.screen.has_previous());
|
|
1522
1525
|
set_sensitive('next', this.screen.has_next());
|
package/src/view/form.js
CHANGED
|
@@ -5568,8 +5568,7 @@ function eval_pyson(value){
|
|
|
5568
5568
|
return this._parse(this.format, this.input.val());
|
|
5569
5569
|
},
|
|
5570
5570
|
set_value: function(value) {
|
|
5571
|
-
if ((value
|
|
5572
|
-
(value instanceof Sao.Date)) {
|
|
5571
|
+
if (value && (value.isDate || value.isDateTime)) {
|
|
5573
5572
|
value = this._format(this.format, value);
|
|
5574
5573
|
} else {
|
|
5575
5574
|
value = '';
|