fix: letter head not found in opening invoice creation tool
This commit is contained in:
parent
41cd4fc788
commit
04cf2e029f
@ -68,6 +68,9 @@ class OpeningInvoiceCreationTool(Document):
|
|||||||
if not self.company:
|
if not self.company:
|
||||||
frappe.throw(_("Please select the 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:
|
for row in self.invoices:
|
||||||
if not row.qty:
|
if not row.qty:
|
||||||
row.qty = 1.0
|
row.qty = 1.0
|
||||||
@ -99,6 +102,12 @@ class OpeningInvoiceCreationTool(Document):
|
|||||||
if not args:
|
if not args:
|
||||||
continue
|
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 = frappe.get_doc(args).insert()
|
||||||
doc.submit()
|
doc.submit()
|
||||||
names.append(doc.name)
|
names.append(doc.name)
|
||||||
@ -172,8 +181,7 @@ class OpeningInvoiceCreationTool(Document):
|
|||||||
"due_date": row.due_date,
|
"due_date": row.due_date,
|
||||||
"posting_date": row.posting_date,
|
"posting_date": row.posting_date,
|
||||||
frappe.scrub(party_type): row.party,
|
frappe.scrub(party_type): row.party,
|
||||||
"doctype": "Sales Invoice" if self.invoice_type == "Sales" else "Purchase Invoice",
|
"doctype": "Sales Invoice" if self.invoice_type == "Sales" else "Purchase Invoice"
|
||||||
"currency": frappe.get_cached_value('Company', self.company, "default_currency")
|
|
||||||
})
|
})
|
||||||
|
|
||||||
accounting_dimension = get_accounting_dimensions()
|
accounting_dimension = get_accounting_dimensions()
|
||||||
|
Loading…
Reference in New Issue
Block a user