mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-20 21:49:18 +00:00
feat(accounts): enable print format selection in Process Statement of Accounts
This commit is contained in:
@@ -83,6 +83,16 @@ frappe.ui.form.on("Process Statement Of Accounts", {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
frm.set_query("print_format", function () {
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
print_format_for: "Report",
|
||||||
|
report: frm.doc.report,
|
||||||
|
disabled: 0,
|
||||||
|
print_format_type: "Jinja",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
if (frm.doc.__islocal) {
|
if (frm.doc.__islocal) {
|
||||||
frm.set_value("from_date", frappe.datetime.add_months(frappe.datetime.get_today(), -1));
|
frm.set_value("from_date", frappe.datetime.add_months(frappe.datetime.get_today(), -1));
|
||||||
frm.set_value("to_date", frappe.datetime.get_today());
|
frm.set_value("to_date", frappe.datetime.get_today());
|
||||||
@@ -106,6 +116,16 @@ frappe.ui.form.on("Process Statement Of Accounts", {
|
|||||||
filters: filters,
|
filters: filters,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
frm.set_query("print_format", function () {
|
||||||
|
return {
|
||||||
|
filters: {
|
||||||
|
print_format_for: "Report",
|
||||||
|
report: frm.doc.report,
|
||||||
|
disabled: 0,
|
||||||
|
print_format_type: "Jinja",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
},
|
},
|
||||||
customer_collection: function (frm) {
|
customer_collection: function (frm) {
|
||||||
frm.set_value("collection_name", "");
|
frm.set_value("collection_name", "");
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
"column_break_17",
|
"column_break_17",
|
||||||
"customers",
|
"customers",
|
||||||
"preferences",
|
"preferences",
|
||||||
|
"print_format",
|
||||||
"orientation",
|
"orientation",
|
||||||
"include_break",
|
"include_break",
|
||||||
"include_ageing",
|
"include_ageing",
|
||||||
@@ -406,10 +407,16 @@
|
|||||||
"fieldname": "show_future_payments",
|
"fieldname": "show_future_payments",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Show Future Payments"
|
"label": "Show Future Payments"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "print_format",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"label": "Print Format",
|
||||||
|
"options": "Print Format"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2025-08-29 00:20:08.088189",
|
"modified": "2025-09-03 14:24:43.608565",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Process Statement Of Accounts",
|
"name": "Process Statement Of Accounts",
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ class ProcessStatementOfAccounts(Document):
|
|||||||
pdf_name: DF.Data | None
|
pdf_name: DF.Data | None
|
||||||
posting_date: DF.Date | None
|
posting_date: DF.Date | None
|
||||||
primary_mandatory: DF.Check
|
primary_mandatory: DF.Check
|
||||||
|
print_format: DF.Link | None
|
||||||
project: DF.TableMultiSelect[PSOAProject]
|
project: DF.TableMultiSelect[PSOAProject]
|
||||||
report: DF.Literal["General Ledger", "Accounts Receivable"]
|
report: DF.Literal["General Ledger", "Accounts Receivable"]
|
||||||
sales_partner: DF.Link | None
|
sales_partner: DF.Link | None
|
||||||
@@ -109,6 +110,11 @@ class ProcessStatementOfAccounts(Document):
|
|||||||
self.to_date = self.start_date
|
self.to_date = self.start_date
|
||||||
self.from_date = add_months(self.to_date, -1 * self.filter_duration)
|
self.from_date = add_months(self.to_date, -1 * self.filter_duration)
|
||||||
|
|
||||||
|
if self.print_format:
|
||||||
|
print_format_type = frappe.db.get_value("Print Format", self.print_format, "print_format_type")
|
||||||
|
if print_format_type != "Jinja":
|
||||||
|
frappe.throw(title=_("Invalid Print Format"), msg=_("Print Format Type should be Jinja."))
|
||||||
|
|
||||||
def validate_account(self):
|
def validate_account(self):
|
||||||
if not self.account:
|
if not self.account:
|
||||||
return
|
return
|
||||||
@@ -290,6 +296,10 @@ def get_html(doc, filters, entry, col, res, ageing):
|
|||||||
if process_soa_html and process_soa_html.get(doc.report):
|
if process_soa_html and process_soa_html.get(doc.report):
|
||||||
template_path = process_soa_html[doc.report][-1]
|
template_path = process_soa_html[doc.report][-1]
|
||||||
|
|
||||||
|
if doc.print_format:
|
||||||
|
custom_html, custom_css = frappe.db.get_value("Print Format", doc.print_format, ["html", "css"])
|
||||||
|
template_path = f"<style>{custom_css}</style> {custom_html}"
|
||||||
|
|
||||||
if doc.letter_head:
|
if doc.letter_head:
|
||||||
from frappe.www.printview import get_letter_head
|
from frappe.www.printview import get_letter_head
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user