fix: allow editable accounting dimensions for repostable doctypes
This commit is contained in:
parent
781bdd2ec9
commit
8bb83e267c
@ -11,6 +11,10 @@ from frappe.model import core_doctypes_list
|
|||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe.utils import cstr
|
from frappe.utils import cstr
|
||||||
|
|
||||||
|
from erpnext.accounts.doctype.repost_accounting_ledger.repost_accounting_ledger import (
|
||||||
|
get_allowed_types_from_settings,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class AccountingDimension(Document):
|
class AccountingDimension(Document):
|
||||||
# begin: auto-generated types
|
# begin: auto-generated types
|
||||||
@ -106,6 +110,7 @@ def make_dimension_in_accounting_doctypes(doc, doclist=None):
|
|||||||
|
|
||||||
doc_count = len(get_accounting_dimensions())
|
doc_count = len(get_accounting_dimensions())
|
||||||
count = 0
|
count = 0
|
||||||
|
repostable_doctypes = get_allowed_types_from_settings()
|
||||||
|
|
||||||
for doctype in doclist:
|
for doctype in doclist:
|
||||||
|
|
||||||
@ -121,6 +126,7 @@ def make_dimension_in_accounting_doctypes(doc, doclist=None):
|
|||||||
"options": doc.document_type,
|
"options": doc.document_type,
|
||||||
"insert_after": insert_after_field,
|
"insert_after": insert_after_field,
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
|
"allow_on_submit": 1 if doctype in repostable_doctypes else 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
meta = frappe.get_meta(doctype, cached=False)
|
meta = frappe.get_meta(doctype, cached=False)
|
||||||
|
|||||||
@ -13,6 +13,10 @@ from erpnext.accounts.deferred_revenue import get_deferred_booking_accounts
|
|||||||
from erpnext.accounts.doctype.invoice_discounting.invoice_discounting import (
|
from erpnext.accounts.doctype.invoice_discounting.invoice_discounting import (
|
||||||
get_party_account_based_on_invoice_discounting,
|
get_party_account_based_on_invoice_discounting,
|
||||||
)
|
)
|
||||||
|
from erpnext.accounts.doctype.repost_accounting_ledger.repost_accounting_ledger import (
|
||||||
|
validate_docs_for_deferred_accounting,
|
||||||
|
validate_docs_for_voucher_types,
|
||||||
|
)
|
||||||
from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category import (
|
from erpnext.accounts.doctype.tax_withholding_category.tax_withholding_category import (
|
||||||
get_party_tax_withholding_details,
|
get_party_tax_withholding_details,
|
||||||
)
|
)
|
||||||
@ -149,6 +153,10 @@ class JournalEntry(AccountsController):
|
|||||||
if not self.title:
|
if not self.title:
|
||||||
self.title = self.get_title()
|
self.title = self.get_title()
|
||||||
|
|
||||||
|
def validate_for_repost(self):
|
||||||
|
validate_docs_for_voucher_types(["Journal Entry"])
|
||||||
|
validate_docs_for_deferred_accounting([self.name], [])
|
||||||
|
|
||||||
def submit(self):
|
def submit(self):
|
||||||
if len(self.accounts) > 100:
|
if len(self.accounts) > 100:
|
||||||
msgprint(_("The task has been enqueued as a background job."), alert=True)
|
msgprint(_("The task has been enqueued as a background job."), alert=True)
|
||||||
@ -177,7 +185,9 @@ class JournalEntry(AccountsController):
|
|||||||
self.needs_repost = self.check_if_fields_updated(
|
self.needs_repost = self.check_if_fields_updated(
|
||||||
fields_to_check=[], child_tables={"accounts": []}
|
fields_to_check=[], child_tables={"accounts": []}
|
||||||
)
|
)
|
||||||
self.db_set("repost_required", self.needs_repost)
|
if self.needs_repost:
|
||||||
|
self.validate_for_repost()
|
||||||
|
self.db_set("repost_required", self.needs_repost)
|
||||||
|
|
||||||
def on_cancel(self):
|
def on_cancel(self):
|
||||||
# References for this Journal are removed on the `on_cancel` event in accounts_controller
|
# References for this Journal are removed on the `on_cancel` event in accounts_controller
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user