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

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

(cherry picked from commit d375164100)

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

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):