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

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:30:36 +05:30 committed by GitHub
parent cbbc6af128
commit 5ec75fb6df
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):