diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 54ab7f03ea0..73b72334b55 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -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 = { diff --git a/erpnext/stock/doctype/company_restriction/test_company_restriction.py b/erpnext/stock/doctype/company_restriction/test_company_restriction.py index d33f5791830..811ce58bb40 100644 --- a/erpnext/stock/doctype/company_restriction/test_company_restriction.py +++ b/erpnext/stock/doctype/company_restriction/test_company_restriction.py @@ -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" + )