mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-21 07:38:29 +00:00
fix: include child doctypes in repostable accounting types
(cherry picked from commit fbd8fd7d22)
This commit is contained in:
@@ -111,17 +111,15 @@ class AccountingDimension(Document):
|
|||||||
def make_dimension_in_accounting_doctypes(doc, doclist=None):
|
def make_dimension_in_accounting_doctypes(doc, doclist=None):
|
||||||
if not doclist:
|
if not doclist:
|
||||||
doclist = get_doctypes_with_dimensions()
|
doclist = get_doctypes_with_dimensions()
|
||||||
|
|
||||||
doc_count = len(get_accounting_dimensions())
|
doc_count = len(get_accounting_dimensions())
|
||||||
count = 0
|
count = 0
|
||||||
repostable_doctypes = get_allowed_types_from_settings()
|
repostable_doctypes = get_allowed_types_from_settings(child_doc=True)
|
||||||
|
|
||||||
for doctype in doclist:
|
for doctype in doclist:
|
||||||
if (doc_count + 1) % 2 == 0:
|
if (doc_count + 1) % 2 == 0:
|
||||||
insert_after_field = "dimension_col_break"
|
insert_after_field = "dimension_col_break"
|
||||||
else:
|
else:
|
||||||
insert_after_field = "accounting_dimensions_section"
|
insert_after_field = "accounting_dimensions_section"
|
||||||
|
|
||||||
df = {
|
df = {
|
||||||
"fieldname": doc.fieldname,
|
"fieldname": doc.fieldname,
|
||||||
"label": doc.label,
|
"label": doc.label,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import inspect
|
|||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _, qb
|
from frappe import _, qb
|
||||||
|
from frappe.desk.form.linked_with import get_child_tables_of_doctypes
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe.utils.data import comma_and
|
from frappe.utils.data import comma_and
|
||||||
|
|
||||||
@@ -208,13 +209,29 @@ def start_repost(account_repost_doc=str) -> None:
|
|||||||
doc.make_gl_entries()
|
doc.make_gl_entries()
|
||||||
|
|
||||||
|
|
||||||
def get_allowed_types_from_settings():
|
def get_allowed_types_from_settings(child_doc: bool = False):
|
||||||
return [
|
repost_docs = [
|
||||||
x.document_type
|
x.document_type
|
||||||
for x in frappe.db.get_all(
|
for x in frappe.db.get_all(
|
||||||
"Repost Allowed Types", filters={"allowed": True}, fields=["distinct(document_type)"]
|
"Repost Allowed Types", filters={"allowed": True}, fields=["distinct(document_type)"]
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
result = repost_docs
|
||||||
|
|
||||||
|
if repost_docs and child_doc:
|
||||||
|
result.extend(get_child_docs(repost_docs))
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def get_child_docs(doc: list) -> list:
|
||||||
|
child_doc = []
|
||||||
|
doc = get_child_tables_of_doctypes(doc)
|
||||||
|
for child_list in doc.values():
|
||||||
|
for child in child_list:
|
||||||
|
if child.get("child_table"):
|
||||||
|
child_doc.append(child["child_table"])
|
||||||
|
return child_doc
|
||||||
|
|
||||||
|
|
||||||
def validate_docs_for_deferred_accounting(sales_docs, purchase_docs):
|
def validate_docs_for_deferred_accounting(sales_docs, purchase_docs):
|
||||||
|
|||||||
Reference in New Issue
Block a user