refactor: hook validate_allowed_companies instead of calling per master

Item, Customer and Supplier each imported and called it in their
validate; register it once in doc_events instead.
This commit is contained in:
Mihir Kandoi
2026-07-22 14:17:32 +05:30
parent 88b8ce3888
commit 01892c2e26
6 changed files with 9 additions and 7 deletions

View File

@@ -400,6 +400,9 @@ doc_events = {
tuple(company_restricted_transaction_doctypes): {
"validate": "erpnext.stock.doctype.company_restriction.company_restriction.validate_transaction_company",
},
("Item", "Customer", "Supplier"): {
"validate": "erpnext.stock.doctype.company_restriction.company_restriction.validate_allowed_companies",
},
"Stock Entry": {
"on_submit": "erpnext.stock.doctype.material_request.material_request.update_completed_and_requested_qty",
"on_cancel": "erpnext.stock.doctype.material_request.material_request.update_completed_and_requested_qty",