Merge pull request #50209 from khushi8112/asset-status-in-list-view

fix: set status to Draft for auto-created assets from Purchase Receipt
This commit is contained in:
Khushi Rawat
2025-10-23 18:31:58 +05:30
committed by GitHub
4 changed files with 18 additions and 1 deletions

View File

@@ -129,6 +129,8 @@ class Asset(AccountsController):
self.set_missing_values()
self.validate_gross_and_purchase_amount()
self.validate_finance_books()
def before_save(self):
self.total_asset_cost = self.net_purchase_amount + self.additional_asset_cost
self.status = self.get_status()

View File

@@ -1048,6 +1048,7 @@ class BuyingController(SubcontractingController):
"asset_category": item_data.get("asset_category"),
"location": row.asset_location,
"company": self.company,
"status": "Draft",
"supplier": self.supplier,
"purchase_date": self.posting_date,
"calculate_depreciation": 0,

View File

@@ -441,4 +441,5 @@ erpnext.patches.v16_0.set_reporting_currency
erpnext.patches.v16_0.set_posting_datetime_for_sabb_and_drop_indexes
erpnext.patches.v16_0.update_serial_no_reference_name
erpnext.patches.v16_0.rename_subcontracted_quantity
erpnext.patches.v16_0.add_new_stock_entry_types
erpnext.patches.v16_0.add_new_stock_entry_types
erpnext.patches.v15_0.set_asset_status_if_not_already_set

View File

@@ -0,0 +1,13 @@
import frappe
from frappe.query_builder import DocType
def execute():
Asset = DocType("Asset")
query = (
frappe.qb.update(Asset)
.set(Asset.status, "Draft")
.where((Asset.docstatus == 0) & ((Asset.status.isnull()) | (Asset.status == "")))
)
query.run()