fix: if not budget then don't validate (backport #38861) (#38864)

fix: if not budget then don't validate (#38861)

(cherry picked from commit d375164100158db9b974742caa3e05062c481d7d)

Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
mergify[bot] 2023-12-19 18:31:18 +05:30 committed by GitHub
parent 4057682c87
commit 793e3ad78e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -169,7 +169,9 @@ class MaterialRequest(BuyingController):
def on_submit(self):
self.update_requested_qty_in_production_plan()
self.update_requested_qty()
if self.material_request_type == "Purchase":
if self.material_request_type == "Purchase" and frappe.db.exists(
"Budget", {"applicable_on_material_request": 1, "docstatus": 1}
):
self.validate_budget()
def before_save(self):