fix: set default asset quantity as 1 [v14] (#38224)

fix: set default asset quantity as 1
This commit is contained in:
Anand Baburajan
2023-11-20 22:27:25 +05:30
committed by GitHub
parent d7278477d6
commit 3daf6f822a
5 changed files with 11 additions and 2 deletions

View File

@@ -495,6 +495,7 @@
"read_only": 1 "read_only": 1
}, },
{ {
"default": "1",
"fieldname": "asset_quantity", "fieldname": "asset_quantity",
"fieldtype": "Int", "fieldtype": "Int",
"label": "Asset Quantity", "label": "Asset Quantity",
@@ -564,7 +565,7 @@
"link_fieldname": "target_asset" "link_fieldname": "target_asset"
} }
], ],
"modified": "2023-11-15 17:40:17.315203", "modified": "2023-11-20 21:05:45.216899",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Assets", "module": "Assets",
"name": "Asset", "name": "Asset",

View File

@@ -1221,6 +1221,7 @@ def get_item_details(item_code, asset_category, gross_purchase_amount):
"expected_value_after_useful_life": flt(gross_purchase_amount) "expected_value_after_useful_life": flt(gross_purchase_amount)
* flt(d.salvage_value_percentage / 100), * flt(d.salvage_value_percentage / 100),
"depreciation_start_date": d.depreciation_start_date or nowdate(), "depreciation_start_date": d.depreciation_start_date or nowdate(),
"rate_of_depreciation": d.rate_of_depreciation,
} }
) )

View File

@@ -746,7 +746,7 @@ class BuyingController(SubcontractingController):
"calculate_depreciation": 1, "calculate_depreciation": 1,
"purchase_receipt_amount": purchase_amount, "purchase_receipt_amount": purchase_amount,
"gross_purchase_amount": purchase_amount, "gross_purchase_amount": purchase_amount,
"asset_quantity": row.qty if is_grouped_asset else 0, "asset_quantity": row.qty if is_grouped_asset else 1,
"purchase_receipt": self.name if self.doctype == "Purchase Receipt" else None, "purchase_receipt": self.name if self.doctype == "Purchase Receipt" else None,
"purchase_invoice": self.name if self.doctype == "Purchase Invoice" else None, "purchase_invoice": self.name if self.doctype == "Purchase Invoice" else None,
"cost_center": row.cost_center, "cost_center": row.cost_center,

View File

@@ -350,5 +350,6 @@ erpnext.patches.v14_0.rename_daily_depreciation_to_depreciation_amount_based_on_
erpnext.patches.v14_0.rename_depreciation_amount_based_on_num_days_in_month_to_daily_prorata_based erpnext.patches.v14_0.rename_depreciation_amount_based_on_num_days_in_month_to_daily_prorata_based
erpnext.patches.v14_0.add_default_for_repost_settings erpnext.patches.v14_0.add_default_for_repost_settings
erpnext.patches.v14_0.create_accounting_dimensions_in_supplier_quotation erpnext.patches.v14_0.create_accounting_dimensions_in_supplier_quotation
erpnext.patches.v14_0.update_zero_asset_quantity_field
# below migration patch should always run last # below migration patch should always run last
erpnext.patches.v14_0.migrate_gl_to_payment_ledger erpnext.patches.v14_0.migrate_gl_to_payment_ledger

View File

@@ -0,0 +1,6 @@
import frappe
def execute():
asset = frappe.qb.DocType("Asset")
frappe.qb.update(asset).set(asset.asset_quantity, 1).where(asset.asset_quantity == 0).run()