Use record name as fallback for filename of Binary field

This commit is contained in:
Cédric Krier
2026-05-07 13:28:19 +02:00
parent 792602c230
commit af8c446a5b
4 changed files with 15 additions and 3 deletions
+1
View File
@@ -1,3 +1,4 @@
* Use record name as fallback for filename of Binary field
* Support filters attribute for binary and image widgets
* Use search window to delete/remove records from xxx2Many widgets
+10 -2
View File
@@ -4641,13 +4641,21 @@ function eval_pyson(value){
} else {
prm = jQuery.when(field.get(record));
}
prm.done(data => {
prm.then(data => {
var name;
var field = this.filename_field;
if (field) {
name = field.get(this.record);
}
Sao.common.download_file(data, name);
let prm;
if (!name) {
prm = this.record.rec_name();
} else {
prm = jQuery.when(name);
}
return prm.then(name => {
Sao.common.download_file(data, name);
});
});
},
clear: function() {
+1
View File
@@ -1,3 +1,4 @@
* Use record name as fallback for filename of Binary field
* Support filters attribute for binary and image widgets
* Use search window to delete/remove records from xxx2Many widgets
@@ -139,9 +139,11 @@ class BinaryMixin(Widget):
file_open(file_path, type_)
def save_as(self, widget=None):
filename = ''
filename = None
if self.filename_field:
filename = self.filename_field.get(self.record)
if not filename:
filename = self.record.rec_name()
filename = file_selection(_('Save As...'), filename=filename,
action=Gtk.FileChooserAction.SAVE)
if filename: