diff --git a/erpnext/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py index e35ebf6ed06..0c50b4460e4 100644 --- a/erpnext/assets/doctype/asset/asset.py +++ b/erpnext/assets/doctype/asset/asset.py @@ -131,6 +131,13 @@ class Asset(AccountsController): self.set_missing_values() self.validate_gross_and_purchase_amount() self.validate_finance_books() +<<<<<<< HEAD +======= + + def before_save(self): + self.total_asset_cost = self.net_purchase_amount + self.additional_asset_cost + self.status = self.get_status() +>>>>>>> 20c2cb40d1 (fix: set status to Draft for auto-created assets from Purchase Receipt) if not self.split_from: self.prepare_depreciation_data() diff --git a/erpnext/controllers/buying_controller.py b/erpnext/controllers/buying_controller.py index fb5cc130f0b..643fafb74ab 100644 --- a/erpnext/controllers/buying_controller.py +++ b/erpnext/controllers/buying_controller.py @@ -878,6 +878,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, diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 0abf1b42ee4..dc083849dca 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -422,3 +422,13 @@ execute:frappe.db.set_single_value("Accounts Settings", "fetch_valuation_rate_fo erpnext.patches.v15_0.add_company_payment_gateway_account erpnext.patches.v15_0.update_uae_zero_rated_fetch erpnext.patches.v15_0.update_fieldname_in_accounting_dimension_filter +<<<<<<< HEAD +======= +erpnext.patches.v16_0.make_workstation_operating_components #1 +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.v15_0.set_asset_status_if_not_already_set +>>>>>>> 20c2cb40d1 (fix: set status to Draft for auto-created assets from Purchase Receipt) diff --git a/erpnext/patches/v15_0/set_asset_status_if_not_already_set.py b/erpnext/patches/v15_0/set_asset_status_if_not_already_set.py new file mode 100644 index 00000000000..ac0af708de4 --- /dev/null +++ b/erpnext/patches/v15_0/set_asset_status_if_not_already_set.py @@ -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()