fix: don't allow capitalizing only service item for new composite asset

(cherry picked from commit f1d2138258)
This commit is contained in:
Khushi Rawat
2024-08-29 01:51:45 +05:30
committed by Mergify
parent 0d6148f218
commit a833010d2b

View File

@@ -317,7 +317,16 @@ class AssetCapitalization(StockController):
if not self.target_is_fixed_asset and not self.get("asset_items"):
frappe.throw(_("Consumed Asset Items is mandatory for Decapitalization"))
if not (self.get("stock_items") or self.get("asset_items") or self.get("service_items")):
if self.capitalization_method == "Create a new composite asset" and not (
self.get("stock_items") or self.get("asset_items")
):
frappe.throw(
_(
"Consumed Stock Items or Consumed Asset Items are mandatory for creating new composite asset"
)
)
elif not (self.get("stock_items") or self.get("asset_items") or self.get("service_items")):
frappe.throw(
_(
"Consumed Stock Items, Consumed Asset Items or Consumed Service Items is mandatory for Capitalization"