fix: add back a limitation to number of the documents

Don't allow printing more than 500 documents

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2024-03-13 11:28:19 +05:30
parent 9bf22b79e4
commit 1caae030ae
No known key found for this signature in database
GPG key ID: 9DCC61E211BF645F

View file

@ -10,6 +10,7 @@ export default class BulkOperations {
const is_submittable = frappe.model.is_submittable(this.doctype);
const allow_print_for_cancelled = cint(print_settings.allow_print_for_cancelled);
const letterheads = this.get_letterhead_options();
const MAX_PRINT_LIMIT = 500;
const valid_docs = docs
.filter((doc) => {
@ -35,6 +36,13 @@ export default class BulkOperations {
return;
}
if (valid_docs.length > MAX_PRINT_LIMIT) {
frappe.msgprint(
__("You can only print upto {0} documents at a time", [MAX_PRINT_LIMIT])
);
return;
}
const dialog = new frappe.ui.Dialog({
title: __("Print Documents"),
fields: [