mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 20:29:09 +00:00
Merge pull request #41089 from khushi8112/rename-purchase-receipt-amount-field-to-purchase-amount
Refactor: Rename purchase receipt amount field to purchase amount
This commit is contained in:
@@ -1207,7 +1207,7 @@ class PurchaseInvoice(BuyingController):
|
|||||||
asset.name,
|
asset.name,
|
||||||
{
|
{
|
||||||
"gross_purchase_amount": purchase_amount,
|
"gross_purchase_amount": purchase_amount,
|
||||||
"purchase_receipt_amount": purchase_amount,
|
"purchase_amount": purchase_amount,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -652,7 +652,7 @@ frappe.ui.form.on("Asset", {
|
|||||||
);
|
);
|
||||||
|
|
||||||
frm.set_value("gross_purchase_amount", purchase_amount);
|
frm.set_value("gross_purchase_amount", purchase_amount);
|
||||||
frm.set_value("purchase_receipt_amount", purchase_amount);
|
frm.set_value("purchase_amount", purchase_amount);
|
||||||
frm.set_value("asset_quantity", asset_quantity);
|
frm.set_value("asset_quantity", asset_quantity);
|
||||||
frm.set_value("cost_center", item.cost_center || purchase_doc.cost_center);
|
frm.set_value("cost_center", item.cost_center || purchase_doc.cost_center);
|
||||||
if (item.asset_location) {
|
if (item.asset_location) {
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
"status",
|
"status",
|
||||||
"booked_fixed_asset",
|
"booked_fixed_asset",
|
||||||
"column_break_51",
|
"column_break_51",
|
||||||
"purchase_receipt_amount",
|
"purchase_amount",
|
||||||
"default_finance_book",
|
"default_finance_book",
|
||||||
"depr_entry_posting_status",
|
"depr_entry_posting_status",
|
||||||
"amended_from",
|
"amended_from",
|
||||||
@@ -408,15 +408,6 @@
|
|||||||
"options": "Purchase Receipt",
|
"options": "Purchase Receipt",
|
||||||
"print_hide": 1
|
"print_hide": 1
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "purchase_receipt_amount",
|
|
||||||
"fieldtype": "Currency",
|
|
||||||
"hidden": 1,
|
|
||||||
"label": "Purchase Receipt Amount",
|
|
||||||
"no_copy": 1,
|
|
||||||
"print_hide": 1,
|
|
||||||
"read_only": 1
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"depends_on": "eval:!doc.is_composite_asset && !doc.is_existing_asset",
|
"depends_on": "eval:!doc.is_composite_asset && !doc.is_existing_asset",
|
||||||
"fieldname": "purchase_invoice",
|
"fieldname": "purchase_invoice",
|
||||||
@@ -546,6 +537,15 @@
|
|||||||
"label": "Additional Asset Cost",
|
"label": "Additional Asset Cost",
|
||||||
"options": "Company:company:default_currency",
|
"options": "Company:company:default_currency",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "purchase_amount",
|
||||||
|
"fieldtype": "Currency",
|
||||||
|
"hidden": 1,
|
||||||
|
"label": "Purchase Amount",
|
||||||
|
"no_copy": 1,
|
||||||
|
"print_hide": 1,
|
||||||
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"idx": 72,
|
"idx": 72,
|
||||||
@@ -589,7 +589,7 @@
|
|||||||
"link_fieldname": "target_asset"
|
"link_fieldname": "target_asset"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2024-03-27 13:06:32.494326",
|
"modified": "2024-04-18 16:45:47.306032",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Assets",
|
"module": "Assets",
|
||||||
"name": "Asset",
|
"name": "Asset",
|
||||||
@@ -628,7 +628,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"show_name_in_global_search": 1,
|
"show_name_in_global_search": 1,
|
||||||
"sort_field": "creation",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
"states": [],
|
"states": [],
|
||||||
"title_field": "asset_name",
|
"title_field": "asset_name",
|
||||||
|
|||||||
@@ -92,10 +92,10 @@ class Asset(AccountsController):
|
|||||||
number_of_depreciations_booked: DF.Int
|
number_of_depreciations_booked: DF.Int
|
||||||
opening_accumulated_depreciation: DF.Currency
|
opening_accumulated_depreciation: DF.Currency
|
||||||
policy_number: DF.Data | None
|
policy_number: DF.Data | None
|
||||||
|
purchase_amount: DF.Currency
|
||||||
purchase_date: DF.Date | None
|
purchase_date: DF.Date | None
|
||||||
purchase_invoice: DF.Link | None
|
purchase_invoice: DF.Link | None
|
||||||
purchase_receipt: DF.Link | None
|
purchase_receipt: DF.Link | None
|
||||||
purchase_receipt_amount: DF.Currency
|
|
||||||
split_from: DF.Link | None
|
split_from: DF.Link | None
|
||||||
status: DF.Literal[
|
status: DF.Literal[
|
||||||
"Draft",
|
"Draft",
|
||||||
@@ -356,7 +356,7 @@ class Asset(AccountsController):
|
|||||||
if self.is_existing_asset:
|
if self.is_existing_asset:
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.gross_purchase_amount and self.gross_purchase_amount != self.purchase_receipt_amount:
|
if self.gross_purchase_amount and self.gross_purchase_amount != self.purchase_amount:
|
||||||
error_message = _(
|
error_message = _(
|
||||||
"Gross Purchase Amount should be <b>equal</b> to purchase amount of one single Asset."
|
"Gross Purchase Amount should be <b>equal</b> to purchase amount of one single Asset."
|
||||||
)
|
)
|
||||||
@@ -695,11 +695,7 @@ class Asset(AccountsController):
|
|||||||
purchase_document = self.get_purchase_document()
|
purchase_document = self.get_purchase_document()
|
||||||
fixed_asset_account, cwip_account = self.get_fixed_asset_account(), self.get_cwip_account()
|
fixed_asset_account, cwip_account = self.get_fixed_asset_account(), self.get_cwip_account()
|
||||||
|
|
||||||
if (
|
if purchase_document and self.purchase_amount and getdate(self.available_for_use_date) <= getdate():
|
||||||
purchase_document
|
|
||||||
and self.purchase_receipt_amount
|
|
||||||
and getdate(self.available_for_use_date) <= getdate()
|
|
||||||
):
|
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict(
|
self.get_gl_dict(
|
||||||
{
|
{
|
||||||
@@ -707,8 +703,8 @@ class Asset(AccountsController):
|
|||||||
"against": fixed_asset_account,
|
"against": fixed_asset_account,
|
||||||
"remarks": self.get("remarks") or _("Accounting Entry for Asset"),
|
"remarks": self.get("remarks") or _("Accounting Entry for Asset"),
|
||||||
"posting_date": self.available_for_use_date,
|
"posting_date": self.available_for_use_date,
|
||||||
"credit": self.purchase_receipt_amount,
|
"credit": self.purchase_amount,
|
||||||
"credit_in_account_currency": self.purchase_receipt_amount,
|
"credit_in_account_currency": self.purchase_amount,
|
||||||
"cost_center": self.cost_center,
|
"cost_center": self.cost_center,
|
||||||
},
|
},
|
||||||
item=self,
|
item=self,
|
||||||
@@ -722,8 +718,8 @@ class Asset(AccountsController):
|
|||||||
"against": cwip_account,
|
"against": cwip_account,
|
||||||
"remarks": self.get("remarks") or _("Accounting Entry for Asset"),
|
"remarks": self.get("remarks") or _("Accounting Entry for Asset"),
|
||||||
"posting_date": self.available_for_use_date,
|
"posting_date": self.available_for_use_date,
|
||||||
"debit": self.purchase_receipt_amount,
|
"debit": self.purchase_amount,
|
||||||
"debit_in_account_currency": self.purchase_receipt_amount,
|
"debit_in_account_currency": self.purchase_amount,
|
||||||
"cost_center": self.cost_center,
|
"cost_center": self.cost_center,
|
||||||
},
|
},
|
||||||
item=self,
|
item=self,
|
||||||
@@ -1119,8 +1115,8 @@ def create_new_asset_after_split(asset, split_qty):
|
|||||||
)
|
)
|
||||||
|
|
||||||
new_asset.gross_purchase_amount = new_gross_purchase_amount
|
new_asset.gross_purchase_amount = new_gross_purchase_amount
|
||||||
if asset.purchase_receipt_amount:
|
if asset.purchase_amount:
|
||||||
new_asset.purchase_receipt_amount = new_gross_purchase_amount
|
new_asset.purchase_amount = new_gross_purchase_amount
|
||||||
new_asset.opening_accumulated_depreciation = opening_accumulated_depreciation
|
new_asset.opening_accumulated_depreciation = opening_accumulated_depreciation
|
||||||
new_asset.asset_quantity = split_qty
|
new_asset.asset_quantity = split_qty
|
||||||
new_asset.split_from = asset.name
|
new_asset.split_from = asset.name
|
||||||
|
|||||||
@@ -1698,7 +1698,7 @@ def create_asset(**args):
|
|||||||
"opening_accumulated_depreciation": args.opening_accumulated_depreciation or 0,
|
"opening_accumulated_depreciation": args.opening_accumulated_depreciation or 0,
|
||||||
"number_of_depreciations_booked": args.number_of_depreciations_booked or 0,
|
"number_of_depreciations_booked": args.number_of_depreciations_booked or 0,
|
||||||
"gross_purchase_amount": args.gross_purchase_amount or 100000,
|
"gross_purchase_amount": args.gross_purchase_amount or 100000,
|
||||||
"purchase_receipt_amount": args.purchase_receipt_amount or 100000,
|
"purchase_amount": args.purchase_amount or 100000,
|
||||||
"maintenance_required": args.maintenance_required or 0,
|
"maintenance_required": args.maintenance_required or 0,
|
||||||
"warehouse": args.warehouse or "_Test Warehouse - _TC",
|
"warehouse": args.warehouse or "_Test Warehouse - _TC",
|
||||||
"available_for_use_date": args.available_for_use_date or "2020-06-06",
|
"available_for_use_date": args.available_for_use_date or "2020-06-06",
|
||||||
|
|||||||
@@ -616,8 +616,7 @@ class AssetCapitalization(StockController):
|
|||||||
asset_doc.available_for_use_date = self.posting_date
|
asset_doc.available_for_use_date = self.posting_date
|
||||||
asset_doc.purchase_date = self.posting_date
|
asset_doc.purchase_date = self.posting_date
|
||||||
asset_doc.gross_purchase_amount = total_target_asset_value
|
asset_doc.gross_purchase_amount = total_target_asset_value
|
||||||
asset_doc.purchase_receipt_amount = total_target_asset_value
|
asset_doc.purchase_amount = total_target_asset_value
|
||||||
asset_doc.purchase_receipt_amount = total_target_asset_value
|
|
||||||
asset_doc.capitalized_in = self.name
|
asset_doc.capitalized_in = self.name
|
||||||
asset_doc.flags.ignore_validate = True
|
asset_doc.flags.ignore_validate = True
|
||||||
asset_doc.flags.asset_created_via_asset_capitalization = True
|
asset_doc.flags.asset_created_via_asset_capitalization = True
|
||||||
@@ -653,7 +652,7 @@ class AssetCapitalization(StockController):
|
|||||||
|
|
||||||
asset_doc = frappe.get_doc("Asset", self.target_asset)
|
asset_doc = frappe.get_doc("Asset", self.target_asset)
|
||||||
asset_doc.gross_purchase_amount = total_target_asset_value
|
asset_doc.gross_purchase_amount = total_target_asset_value
|
||||||
asset_doc.purchase_receipt_amount = total_target_asset_value
|
asset_doc.purchase_amount = total_target_asset_value
|
||||||
asset_doc.capitalized_in = self.name
|
asset_doc.capitalized_in = self.name
|
||||||
asset_doc.flags.ignore_validate = True
|
asset_doc.flags.ignore_validate = True
|
||||||
asset_doc.save()
|
asset_doc.save()
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class TestAssetCapitalization(unittest.TestCase):
|
|||||||
# Test Target Asset values
|
# Test Target Asset values
|
||||||
target_asset = frappe.get_doc("Asset", asset_capitalization.target_asset)
|
target_asset = frappe.get_doc("Asset", asset_capitalization.target_asset)
|
||||||
self.assertEqual(target_asset.gross_purchase_amount, total_amount)
|
self.assertEqual(target_asset.gross_purchase_amount, total_amount)
|
||||||
self.assertEqual(target_asset.purchase_receipt_amount, total_amount)
|
self.assertEqual(target_asset.purchase_amount, total_amount)
|
||||||
|
|
||||||
# Test Consumed Asset values
|
# Test Consumed Asset values
|
||||||
self.assertEqual(consumed_asset.db_get("status"), "Capitalized")
|
self.assertEqual(consumed_asset.db_get("status"), "Capitalized")
|
||||||
@@ -179,7 +179,7 @@ class TestAssetCapitalization(unittest.TestCase):
|
|||||||
# Test Target Asset values
|
# Test Target Asset values
|
||||||
target_asset = frappe.get_doc("Asset", asset_capitalization.target_asset)
|
target_asset = frappe.get_doc("Asset", asset_capitalization.target_asset)
|
||||||
self.assertEqual(target_asset.gross_purchase_amount, total_amount)
|
self.assertEqual(target_asset.gross_purchase_amount, total_amount)
|
||||||
self.assertEqual(target_asset.purchase_receipt_amount, total_amount)
|
self.assertEqual(target_asset.purchase_amount, total_amount)
|
||||||
|
|
||||||
# Test Consumed Asset values
|
# Test Consumed Asset values
|
||||||
self.assertEqual(consumed_asset.db_get("status"), "Capitalized")
|
self.assertEqual(consumed_asset.db_get("status"), "Capitalized")
|
||||||
@@ -256,7 +256,7 @@ class TestAssetCapitalization(unittest.TestCase):
|
|||||||
# Test Target Asset values
|
# Test Target Asset values
|
||||||
target_asset = frappe.get_doc("Asset", asset_capitalization.target_asset)
|
target_asset = frappe.get_doc("Asset", asset_capitalization.target_asset)
|
||||||
self.assertEqual(target_asset.gross_purchase_amount, total_amount)
|
self.assertEqual(target_asset.gross_purchase_amount, total_amount)
|
||||||
self.assertEqual(target_asset.purchase_receipt_amount, total_amount)
|
self.assertEqual(target_asset.purchase_amount, total_amount)
|
||||||
|
|
||||||
# Test General Ledger Entries
|
# Test General Ledger Entries
|
||||||
expected_gle = {
|
expected_gle = {
|
||||||
@@ -526,7 +526,7 @@ def create_depreciation_asset(**args):
|
|||||||
asset.available_for_use_date = args.available_for_use_date or asset.purchase_date
|
asset.available_for_use_date = args.available_for_use_date or asset.purchase_date
|
||||||
|
|
||||||
asset.gross_purchase_amount = args.asset_value or 100000
|
asset.gross_purchase_amount = args.asset_value or 100000
|
||||||
asset.purchase_receipt_amount = asset.gross_purchase_amount
|
asset.purchase_amount = asset.gross_purchase_amount
|
||||||
|
|
||||||
finance_book = asset.append("finance_books")
|
finance_book = asset.append("finance_books")
|
||||||
finance_book.depreciation_start_date = args.depreciation_start_date or "2020-12-31"
|
finance_book.depreciation_start_date = args.depreciation_start_date or "2020-12-31"
|
||||||
|
|||||||
@@ -789,7 +789,7 @@ class BuyingController(SubcontractingController):
|
|||||||
"supplier": self.supplier,
|
"supplier": self.supplier,
|
||||||
"purchase_date": self.posting_date,
|
"purchase_date": self.posting_date,
|
||||||
"calculate_depreciation": 0,
|
"calculate_depreciation": 0,
|
||||||
"purchase_receipt_amount": purchase_amount,
|
"purchase_amount": purchase_amount,
|
||||||
"gross_purchase_amount": purchase_amount,
|
"gross_purchase_amount": purchase_amount,
|
||||||
"asset_quantity": asset_quantity,
|
"asset_quantity": asset_quantity,
|
||||||
"purchase_receipt": self.name if self.doctype == "Purchase Receipt" else None,
|
"purchase_receipt": self.name if self.doctype == "Purchase Receipt" else None,
|
||||||
|
|||||||
@@ -365,3 +365,4 @@ erpnext.patches.v14_0.set_maintain_stock_for_bom_item
|
|||||||
erpnext.patches.v15_0.delete_orphaned_asset_movement_item_records
|
erpnext.patches.v15_0.delete_orphaned_asset_movement_item_records
|
||||||
erpnext.patches.v15_0.remove_cancelled_asset_capitalization_from_asset
|
erpnext.patches.v15_0.remove_cancelled_asset_capitalization_from_asset
|
||||||
erpnext.patches.v15_0.fix_debit_credit_in_transaction_currency
|
erpnext.patches.v15_0.fix_debit_credit_in_transaction_currency
|
||||||
|
erpnext.patches.v15_0.rename_purchase_receipt_amount_to_purchase_amount
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import frappe
|
||||||
|
from frappe.model.utils.rename_field import rename_field
|
||||||
|
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
frappe.reload_doc("assets", "doctype", "asset")
|
||||||
|
if frappe.db.has_column("Asset", "purchase_receipt_amount"):
|
||||||
|
rename_field("Asset", "purchase_receipt_amount", "purchase_amount")
|
||||||
@@ -849,7 +849,7 @@ class PurchaseReceipt(BuyingController):
|
|||||||
asset.name,
|
asset.name,
|
||||||
{
|
{
|
||||||
"gross_purchase_amount": purchase_amount,
|
"gross_purchase_amount": purchase_amount,
|
||||||
"purchase_receipt_amount": purchase_amount,
|
"purchase_amount": purchase_amount,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user