Skip to content

Commit

Permalink
feat(E Invoice Import): only allow upload of XML or PDF files
Browse files Browse the repository at this point in the history
  • Loading branch information
barredterra committed Sep 9, 2024
1 parent d2a86d6 commit f199ec2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ frappe.ui.form.on("E Invoice Import", {
});
},
refresh: function (frm) {
const attach_field = frm.fields_dict["einvoice"];
attach_field.on_attach_click = function () {
attach_field.set_upload_options();
attach_field.upload_options.restrictions.allowed_file_types = [
"application/pdf",
"application/xml",
"text/xml",
];
attach_field.file_uploader = new frappe.ui.FileUploader(attach_field.upload_options);
};

if (frm.doc.docstatus === 1) {
frm.add_custom_button(
__("Purchase Invoice"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"label": "File Section"
},
{
"description": "Upload the <code>.xml</code> or <code>.pdf</code> file provided by your supplier.",
"fieldname": "einvoice",
"fieldtype": "Attach",
"label": "E-Invoice"
Expand Down Expand Up @@ -246,7 +247,7 @@
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2024-08-26 18:48:05.470456",
"modified": "2024-09-09 12:08:08.252121",
"modified_by": "Administrator",
"module": "European e-Invoice",
"name": "E Invoice Import",
Expand Down

0 comments on commit f199ec2

Please sign in to comment.