mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-05 14:38:26 +00:00
Merge pull request #24054 from gwhitney/other_app_acc_dims
feat(Accounting Dimension): accounting dimension doctypes for other apps
This commit is contained in:
@@ -61,8 +61,10 @@ class AccountingDimension(Document):
|
|||||||
def on_update(self):
|
def on_update(self):
|
||||||
frappe.flags.accounting_dimensions = None
|
frappe.flags.accounting_dimensions = None
|
||||||
|
|
||||||
def make_dimension_in_accounting_doctypes(doc):
|
def make_dimension_in_accounting_doctypes(doc, doclist=None):
|
||||||
doclist = get_doctypes_with_dimensions()
|
if not doclist:
|
||||||
|
doclist = get_doctypes_with_dimensions()
|
||||||
|
|
||||||
doc_count = len(get_accounting_dimensions())
|
doc_count = len(get_accounting_dimensions())
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
@@ -82,13 +84,13 @@ def make_dimension_in_accounting_doctypes(doc):
|
|||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
}
|
}
|
||||||
|
|
||||||
if doctype == "Budget":
|
meta = frappe.get_meta(doctype, cached=False)
|
||||||
add_dimension_to_budget_doctype(df, doc)
|
fieldnames = [d.fieldname for d in meta.get("fields")]
|
||||||
else:
|
|
||||||
meta = frappe.get_meta(doctype, cached=False)
|
|
||||||
fieldnames = [d.fieldname for d in meta.get("fields")]
|
|
||||||
|
|
||||||
if df['fieldname'] not in fieldnames:
|
if df['fieldname'] not in fieldnames:
|
||||||
|
if doctype == "Budget":
|
||||||
|
add_dimension_to_budget_doctype(df.copy(), doc)
|
||||||
|
else:
|
||||||
create_custom_field(doctype, df)
|
create_custom_field(doctype, df)
|
||||||
|
|
||||||
count += 1
|
count += 1
|
||||||
@@ -178,15 +180,7 @@ def toggle_disabling(doc):
|
|||||||
frappe.clear_cache(doctype=doctype)
|
frappe.clear_cache(doctype=doctype)
|
||||||
|
|
||||||
def get_doctypes_with_dimensions():
|
def get_doctypes_with_dimensions():
|
||||||
doclist = ["GL Entry", "Sales Invoice", "POS Invoice", "Purchase Invoice", "Payment Entry", "Asset",
|
return frappe.get_hooks("accounting_dimension_doctypes")
|
||||||
"Expense Claim", "Expense Claim Detail", "Expense Taxes and Charges", "Stock Entry", "Budget", "Payroll Entry", "Delivery Note",
|
|
||||||
"Sales Invoice Item", "POS Invoice Item", "Purchase Invoice Item", "Purchase Order Item", "Journal Entry Account", "Material Request Item", "Delivery Note Item",
|
|
||||||
"Purchase Receipt Item", "Stock Entry Detail", "Payment Entry Deduction", "Sales Taxes and Charges", "Purchase Taxes and Charges", "Shipping Rule",
|
|
||||||
"Landed Cost Item", "Asset Value Adjustment", "Loyalty Program", "Fee Schedule", "Fee Structure", "Stock Reconciliation",
|
|
||||||
"Travel Request", "Fees", "POS Profile", "Opening Invoice Creation Tool", "Opening Invoice Creation Tool Item", "Subscription",
|
|
||||||
"Subscription Plan"]
|
|
||||||
|
|
||||||
return doclist
|
|
||||||
|
|
||||||
def get_accounting_dimensions(as_list=True):
|
def get_accounting_dimensions(as_list=True):
|
||||||
if frappe.flags.accounting_dimensions is None:
|
if frappe.flags.accounting_dimensions is None:
|
||||||
|
|||||||
@@ -393,6 +393,15 @@ payment_gateway_enabled = "erpnext.accounts.utils.create_payment_gateway_account
|
|||||||
|
|
||||||
communication_doctypes = ["Customer", "Supplier"]
|
communication_doctypes = ["Customer", "Supplier"]
|
||||||
|
|
||||||
|
accounting_dimension_doctypes = ["GL Entry", "Sales Invoice", "Purchase Invoice", "Payment Entry", "Asset",
|
||||||
|
"Expense Claim", "Expense Claim Detail", "Expense Taxes and Charges", "Stock Entry", "Budget", "Payroll Entry", "Delivery Note",
|
||||||
|
"Sales Invoice Item", "Purchase Invoice Item", "Purchase Order Item", "Journal Entry Account", "Material Request Item", "Delivery Note Item",
|
||||||
|
"Purchase Receipt Item", "Stock Entry Detail", "Payment Entry Deduction", "Sales Taxes and Charges", "Purchase Taxes and Charges", "Shipping Rule",
|
||||||
|
"Landed Cost Item", "Asset Value Adjustment", "Loyalty Program", "Fee Schedule", "Fee Structure", "Stock Reconciliation",
|
||||||
|
"Travel Request", "Fees", "POS Profile", "Opening Invoice Creation Tool", "Opening Invoice Creation Tool Item", "Subscription",
|
||||||
|
"Subscription Plan"
|
||||||
|
]
|
||||||
|
|
||||||
regional_overrides = {
|
regional_overrides = {
|
||||||
'France': {
|
'France': {
|
||||||
'erpnext.tests.test_regional.test_method': 'erpnext.regional.france.utils.test_method'
|
'erpnext.tests.test_regional.test_method': 'erpnext.regional.france.utils.test_method'
|
||||||
|
|||||||
Reference in New Issue
Block a user