default Sales Invoice Print Format
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,18 @@
|
||||
[
|
||||
{
|
||||
"default_value": null,
|
||||
"doc_type": "Sales Invoice",
|
||||
"docstatus": 0,
|
||||
"doctype": "Property Setter",
|
||||
"doctype_or_field": "DocType",
|
||||
"field_name": null,
|
||||
"is_system_generated": 1,
|
||||
"modified": "2026-09-10 13:55:13.996942",
|
||||
"module": null,
|
||||
"name": "Sales Invoice-main-default_print_format",
|
||||
"property": "default_print_format",
|
||||
"property_type": "Data",
|
||||
"row_name": null,
|
||||
"value": "Default Standard Sales Invoice"
|
||||
}
|
||||
]
|
||||
@@ -75,7 +75,10 @@ required_apps = ["erpnext"]
|
||||
|
||||
# add methods and filters to jinja environment
|
||||
jinja = {
|
||||
"methods": ["default_thai_company.utils.get_letter_head_company"],
|
||||
"methods": [
|
||||
"default_thai_company.utils.get_letter_head_company",
|
||||
"default_thai_company.utils.get_company_bank_account",
|
||||
],
|
||||
}
|
||||
|
||||
# Fixtures
|
||||
@@ -84,6 +87,11 @@ jinja = {
|
||||
fixtures = [
|
||||
{"doctype": "Letter Head", "filters": [["name", "in", ["Default Letter Head"]]]},
|
||||
{"doctype": "Address Template", "filters": [["name", "in", ["Thailand"]]]},
|
||||
{"doctype": "Print Format", "filters": [["name", "in", ["Default Standard Sales Invoice"]]]},
|
||||
{
|
||||
"doctype": "Property Setter",
|
||||
"filters": [["name", "in", ["Sales Invoice-main-default_print_format"]]],
|
||||
},
|
||||
]
|
||||
|
||||
# Installation
|
||||
|
||||
@@ -29,6 +29,28 @@ def get_letter_head_company(doc=None):
|
||||
)
|
||||
|
||||
|
||||
def get_company_bank_account(company=None):
|
||||
"""Default company Bank Account for print formats.
|
||||
|
||||
Returns the enabled Bank Account flagged `Is Company Account` and
|
||||
`Is Default Account` for `company`, or None when there is none.
|
||||
"""
|
||||
if not company:
|
||||
return None
|
||||
|
||||
account = frappe.db.get_value(
|
||||
"Bank Account",
|
||||
{"company": company, "is_company_account": 1, "is_default": 1, "disabled": 0},
|
||||
["account_name", "bank", "bank_account_no", "iban", "branch_code"],
|
||||
as_dict=True,
|
||||
)
|
||||
if not account:
|
||||
return None
|
||||
|
||||
account.swift_number = frappe.db.get_value("Bank", account.bank, "swift_number")
|
||||
return account
|
||||
|
||||
|
||||
def stash_letter_head_source(doc, method=None):
|
||||
"""Fixture import re-inserts the Letter Head; remember the fixture's `source`."""
|
||||
doc.flags.fixture_source = doc.source
|
||||
|
||||
Reference in New Issue
Block a user