Merge pull request #22488 from rohitwaghchaure/fixed-letter-head-not-found
fix: letter head not found in opening invoice creation tool
diff --git a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py
index 54464e7..a53417e 100644
--- a/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py
+++ b/erpnext/accounts/doctype/opening_invoice_creation_tool/opening_invoice_creation_tool.py
@@ -68,6 +68,9 @@
if not self.company:
frappe.throw(_("Please select the Company"))
+ company_details = frappe.get_cached_value('Company', self.company,
+ ["default_currency", "default_letter_head"], as_dict=1) or {}
+
for row in self.invoices:
if not row.qty:
row.qty = 1.0
@@ -99,6 +102,12 @@
if not args:
continue
+ if company_details:
+ args.update({
+ "currency": company_details.get("default_currency"),
+ "letter_head": company_details.get("default_letter_head")
+ })
+
doc = frappe.get_doc(args).insert()
doc.submit()
names.append(doc.name)
@@ -172,8 +181,7 @@
"due_date": row.due_date,
"posting_date": row.posting_date,
frappe.scrub(party_type): row.party,
- "doctype": "Sales Invoice" if self.invoice_type == "Sales" else "Purchase Invoice",
- "currency": frappe.get_cached_value('Company', self.company, "default_currency")
+ "doctype": "Sales Invoice" if self.invoice_type == "Sales" else "Purchase Invoice"
})
accounting_dimension = get_accounting_dimensions()