mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-31 15:32:27 +00:00
refactor: exempt system doctypes via in_create flag
Doctypes marked In Create (GL Entry, Stock Ledger Entry, Bin, ledger entries) are system-created by definition, so derive their exemption from meta instead of listing them.
This commit is contained in:
@@ -13,17 +13,12 @@ RESTRICTABLE_MASTER_DOCTYPES = ("Item", "Customer", "Supplier")
|
|||||||
|
|
||||||
COMPANY_RESTRICTION_EXEMPT_DOCTYPES = frozenset(
|
COMPANY_RESTRICTION_EXEMPT_DOCTYPES = frozenset(
|
||||||
{
|
{
|
||||||
"Advance Payment Ledger Entry",
|
|
||||||
"Asset",
|
"Asset",
|
||||||
"Bank Transaction",
|
"Bank Transaction",
|
||||||
"Bin",
|
|
||||||
"Exchange Rate Revaluation",
|
"Exchange Rate Revaluation",
|
||||||
"GL Entry",
|
|
||||||
"Landed Cost Voucher",
|
"Landed Cost Voucher",
|
||||||
"Loyalty Point Entry",
|
|
||||||
"POS Closing Entry",
|
"POS Closing Entry",
|
||||||
"POS Invoice Merge Log",
|
"POS Invoice Merge Log",
|
||||||
"Payment Ledger Entry",
|
|
||||||
"Payment Reconciliation",
|
"Payment Reconciliation",
|
||||||
"Process Payment Reconciliation",
|
"Process Payment Reconciliation",
|
||||||
"Repost Accounting Ledger",
|
"Repost Accounting Ledger",
|
||||||
@@ -31,9 +26,6 @@ COMPANY_RESTRICTION_EXEMPT_DOCTYPES = frozenset(
|
|||||||
"Repost Payment Ledger",
|
"Repost Payment Ledger",
|
||||||
"Serial No",
|
"Serial No",
|
||||||
"Serial and Batch Bundle",
|
"Serial and Batch Bundle",
|
||||||
"Stock Closing Balance",
|
|
||||||
"Stock Ledger Entry",
|
|
||||||
"Stock Reservation Entry",
|
|
||||||
"Unreconcile Payment",
|
"Unreconcile Payment",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -136,7 +128,7 @@ def validate_allowed_companies(doc, method=None):
|
|||||||
|
|
||||||
|
|
||||||
def validate_transaction_company(doc, method=None):
|
def validate_transaction_company(doc, method=None):
|
||||||
if doc.doctype in COMPANY_RESTRICTION_EXEMPT_DOCTYPES:
|
if doc.doctype in COMPANY_RESTRICTION_EXEMPT_DOCTYPES or doc.meta.in_create:
|
||||||
return
|
return
|
||||||
|
|
||||||
company_field = doc.meta.get_field("company")
|
company_field = doc.meta.get_field("company")
|
||||||
|
|||||||
Reference in New Issue
Block a user