Merge pull request #7341 from netchampfaris/attach-get-value
fix: Attach get_value
This commit is contained in:
commit
02fbf8de9d
2 changed files with 7 additions and 18 deletions
|
|
@ -364,11 +364,13 @@ export default {
|
|||
}
|
||||
} else {
|
||||
file.failed = true;
|
||||
let error = null;
|
||||
try {
|
||||
console.error(JSON.parse(xhr.responseText));
|
||||
error = JSON.parse(xhr.responseText);
|
||||
} catch(e) {
|
||||
console.error(xhr.responseText);
|
||||
// pass
|
||||
}
|
||||
frappe.request.cleanup({}, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,29 +83,16 @@ frappe.ui.form.ControlAttach = frappe.ui.form.ControlData.extend({
|
|||
},
|
||||
|
||||
get_value: function() {
|
||||
if ( this.fileobj ) {
|
||||
if ( this.fileobj.file_url ) {
|
||||
return this.fileobj.file_url;
|
||||
} else if ( this.fileobj.filename ) {
|
||||
var dataURI = this.fileobj.filename + ',' + this.dataurl;
|
||||
|
||||
return dataURI;
|
||||
}
|
||||
} else {
|
||||
return this.value || null;
|
||||
}
|
||||
return this.value || null;
|
||||
},
|
||||
|
||||
on_upload_complete: function(attachment) {
|
||||
if(this.frm) {
|
||||
this.parse_validate_and_set_in_model(attachment.file_url);
|
||||
this.refresh();
|
||||
this.frm.attachments.update_attachment(attachment);
|
||||
this.frm.doc.docstatus == 1 ? this.frm.save('Update') : this.frm.save();
|
||||
} else {
|
||||
this.value = this.get_value();
|
||||
this.refresh();
|
||||
frappe.hide_progress();
|
||||
}
|
||||
this.value = attachment.file_url;
|
||||
this.refresh();
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue