Skip to content

Commit

Permalink
fix: Link attachment in webform for new file (bp #12097) (#12102)
Browse files Browse the repository at this point in the history
(cherry picked from commit 85d6a64)

Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
  • Loading branch information
mergify[bot] and surajshetty3416 committed Dec 19, 2020
1 parent c47f03c commit a670513
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions frappe/public/js/frappe/web_form/web_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export default class WebForm extends frappe.ui.FieldGroup {
}

save() {
let is_new = this.is_new;
if (this.validate && !this.validate()) {
frappe.throw(__("Couldn't save, please check the data you have entered"), __("Validation Error"));
}
Expand Down Expand Up @@ -139,6 +140,18 @@ export default class WebForm extends frappe.ui.FieldGroup {
this.handle_success(response.message);
frappe.web_form.events.trigger('after_save');
this.after_save && this.after_save();
// args doctype and docname added to link doctype in file manager
if (is_new) {
frappe.call({
type: 'POST',
method: "frappe.handler.upload_file",
args: {
file_url: response.message.attachment,
doctype: response.message.doctype,
docname: response.message.name
}
});
}
}
},
always: function() {
Expand Down

0 comments on commit a670513

Please sign in to comment.