mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-11 21:51:48 +00:00
fix: cover manufacturing, logistics, asset and service doctypes
Extend company restriction enforcement to the remaining user-entered transactions (BOM, Work Order, Job Card, Production Plan, Pick List, Blanket Order, asset and maintenance documents). Ledger and repost doctypes stay excluded so cancelling or reposting older documents keeps working after a restriction changes.
This commit is contained in:
@@ -382,6 +382,19 @@ company_restricted_transaction_doctypes = [
|
||||
"Journal Entry",
|
||||
"Subcontracting Order",
|
||||
"Subcontracting Receipt",
|
||||
"BOM",
|
||||
"Work Order",
|
||||
"Job Card",
|
||||
"Production Plan",
|
||||
"Pick List",
|
||||
"Blanket Order",
|
||||
"Asset Capitalization",
|
||||
"Asset Repair",
|
||||
"Dunning",
|
||||
"Installation Note",
|
||||
"Maintenance Schedule",
|
||||
"Maintenance Visit",
|
||||
"Warranty Claim",
|
||||
]
|
||||
|
||||
doc_events = {
|
||||
|
||||
@@ -59,3 +59,11 @@ class TestCompanyRestriction(ERPNextTestSuite):
|
||||
item = make_item()
|
||||
item.restrict_to_companies = 1
|
||||
self.assertRaises(frappe.MandatoryError, item.save)
|
||||
|
||||
def test_hooked_doctypes_have_company_field(self):
|
||||
from erpnext.hooks import company_restricted_transaction_doctypes
|
||||
|
||||
for doctype in company_restricted_transaction_doctypes:
|
||||
self.assertTrue(
|
||||
frappe.get_meta(doctype).has_field("company"), f"{doctype} has no company field"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user