mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
refactor: use correct field name
This commit is contained in:
@@ -379,7 +379,7 @@ class Asset(AccountsController):
|
|||||||
self.asset_category = frappe.get_cached_value("Item", self.item_code, "asset_category")
|
self.asset_category = frappe.get_cached_value("Item", self.item_code, "asset_category")
|
||||||
|
|
||||||
if not flt(self.net_purchase_amount) and not self.is_composite_asset:
|
if not flt(self.net_purchase_amount) and not self.is_composite_asset:
|
||||||
frappe.throw(_("Gross Purchase Amount is mandatory"), frappe.MandatoryError)
|
frappe.throw(_("Net Purchase Amount is mandatory"), frappe.MandatoryError)
|
||||||
|
|
||||||
if is_cwip_accounting_enabled(self.asset_category):
|
if is_cwip_accounting_enabled(self.asset_category):
|
||||||
if (
|
if (
|
||||||
@@ -440,11 +440,11 @@ class Asset(AccountsController):
|
|||||||
|
|
||||||
if self.net_purchase_amount and self.net_purchase_amount != self.purchase_amount:
|
if self.net_purchase_amount and self.net_purchase_amount != self.purchase_amount:
|
||||||
error_message = _(
|
error_message = _(
|
||||||
"Gross Purchase Amount should be <b>equal</b> to purchase amount of one single Asset."
|
"Net Purchase Amount should be <b>equal</b> to purchase amount of one single Asset."
|
||||||
)
|
)
|
||||||
error_message += "<br>"
|
error_message += "<br>"
|
||||||
error_message += _("Please do not book expense of multiple assets against one single Asset.")
|
error_message += _("Please do not book expense of multiple assets against one single Asset.")
|
||||||
frappe.throw(error_message, title=_("Invalid Gross Purchase Amount"))
|
frappe.throw(error_message, title=_("Invalid Net Purchase Amount"))
|
||||||
|
|
||||||
def make_asset_movement(self):
|
def make_asset_movement(self):
|
||||||
reference_doctype = "Purchase Receipt" if self.purchase_receipt else "Purchase Invoice"
|
reference_doctype = "Purchase Receipt" if self.purchase_receipt else "Purchase Invoice"
|
||||||
@@ -488,7 +488,7 @@ class Asset(AccountsController):
|
|||||||
)
|
)
|
||||||
if flt(row.expected_value_after_useful_life) >= flt(self.net_purchase_amount):
|
if flt(row.expected_value_after_useful_life) >= flt(self.net_purchase_amount):
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_("Row {0}: Expected Value After Useful Life must be less than Gross Purchase Amount").format(
|
_("Row {0}: Expected Value After Useful Life must be less than Net Purchase Amount").format(
|
||||||
row.idx
|
row.idx
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -380,12 +380,12 @@ class DepreciationScheduleController(StraightLineMethod, WDVMethod):
|
|||||||
|
|
||||||
def validate_depreciation_amount_for_low_value_assets(self):
|
def validate_depreciation_amount_for_low_value_assets(self):
|
||||||
"""
|
"""
|
||||||
If gross purchase amount is too low, then depreciation amount
|
If net purchase amount is too low, then depreciation amount
|
||||||
can come zero sometimes based on the frequency and number of depreciations.
|
can come zero sometimes based on the frequency and number of depreciations.
|
||||||
"""
|
"""
|
||||||
if flt(self.depreciation_amount, self.asset_doc.precision("net_purchase_amount")) <= 0:
|
if flt(self.depreciation_amount, self.asset_doc.precision("net_purchase_amount")) <= 0:
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_("Gross Purchase Amount {0} cannot be depreciated over {1} cycles.").format(
|
_("Net Purchase Amount {0} cannot be depreciated over {1} cycles.").format(
|
||||||
frappe.bold(self.asset_doc.net_purchase_amount),
|
frappe.bold(self.asset_doc.net_purchase_amount),
|
||||||
frappe.bold(self.fb_row.total_number_of_depreciations),
|
frappe.bold(self.fb_row.total_number_of_depreciations),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ def get_data(filters):
|
|||||||
"purchase_receipt",
|
"purchase_receipt",
|
||||||
"asset_category",
|
"asset_category",
|
||||||
"purchase_date",
|
"purchase_date",
|
||||||
"gross_purchase_amount",
|
"net_purchase_amount",
|
||||||
"location",
|
"location",
|
||||||
"available_for_use_date",
|
"available_for_use_date",
|
||||||
"purchase_invoice",
|
"purchase_invoice",
|
||||||
@@ -87,7 +87,7 @@ def get_data(filters):
|
|||||||
depreciation_amount = depreciation_amount_map.get(asset.asset_id) or 0.0
|
depreciation_amount = depreciation_amount_map.get(asset.asset_id) or 0.0
|
||||||
revaluation_amount = revaluation_amount_map.get(asset.asset_id, 0.0)
|
revaluation_amount = revaluation_amount_map.get(asset.asset_id, 0.0)
|
||||||
asset_value = (
|
asset_value = (
|
||||||
asset.gross_purchase_amount
|
asset.net_purchase_amount
|
||||||
- asset.opening_accumulated_depreciation
|
- asset.opening_accumulated_depreciation
|
||||||
- depreciation_amount
|
- depreciation_amount
|
||||||
+ revaluation_amount
|
+ revaluation_amount
|
||||||
@@ -101,7 +101,7 @@ def get_data(filters):
|
|||||||
"cost_center": asset.cost_center,
|
"cost_center": asset.cost_center,
|
||||||
"vendor_name": pr_supplier_map.get(asset.purchase_receipt)
|
"vendor_name": pr_supplier_map.get(asset.purchase_receipt)
|
||||||
or pi_supplier_map.get(asset.purchase_invoice),
|
or pi_supplier_map.get(asset.purchase_invoice),
|
||||||
"gross_purchase_amount": asset.gross_purchase_amount,
|
"net_purchase_amount": asset.net_purchase_amount,
|
||||||
"opening_accumulated_depreciation": asset.opening_accumulated_depreciation,
|
"opening_accumulated_depreciation": asset.opening_accumulated_depreciation,
|
||||||
"depreciated_amount": depreciation_amount,
|
"depreciated_amount": depreciation_amount,
|
||||||
"available_for_use_date": asset.available_for_use_date,
|
"available_for_use_date": asset.available_for_use_date,
|
||||||
@@ -370,7 +370,7 @@ def get_group_by_data(
|
|||||||
a["depreciated_amount"] = depreciation_amount_map.get(a["name"], 0.0)
|
a["depreciated_amount"] = depreciation_amount_map.get(a["name"], 0.0)
|
||||||
a["revaluation_amount"] = revaluation_amount_map.get(a["name"], 0.0)
|
a["revaluation_amount"] = revaluation_amount_map.get(a["name"], 0.0)
|
||||||
a["asset_value"] = (
|
a["asset_value"] = (
|
||||||
a["gross_purchase_amount"]
|
a["net_purchase_amount"]
|
||||||
- a["opening_accumulated_depreciation"]
|
- a["opening_accumulated_depreciation"]
|
||||||
- a["depreciated_amount"]
|
- a["depreciated_amount"]
|
||||||
+ a["revaluation_amount"]
|
+ a["revaluation_amount"]
|
||||||
@@ -435,7 +435,7 @@ def get_columns(filters):
|
|||||||
"width": 216,
|
"width": 216,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": _("Gross Purchase Amount"),
|
"label": _("Net Purchase Amount"),
|
||||||
"fieldname": "net_purchase_amount",
|
"fieldname": "net_purchase_amount",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"options": "Company:company:default_currency",
|
"options": "Company:company:default_currency",
|
||||||
@@ -496,7 +496,7 @@ def get_columns(filters):
|
|||||||
"width": 90,
|
"width": 90,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"label": _("Gross Purchase Amount"),
|
"label": _("Net Purchase Amount"),
|
||||||
"fieldname": "net_purchase_amount",
|
"fieldname": "net_purchase_amount",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"options": "Company:company:default_currency",
|
"options": "Company:company:default_currency",
|
||||||
|
|||||||
@@ -263,6 +263,7 @@ erpnext.patches.v15_0.rename_subcontracting_fields
|
|||||||
erpnext.patches.v15_0.unset_incorrect_additional_discount_percentage
|
erpnext.patches.v15_0.unset_incorrect_additional_discount_percentage
|
||||||
|
|
||||||
[post_model_sync]
|
[post_model_sync]
|
||||||
|
erpnext.patches.v15_0.rename_gross_purchase_amount_to_net_purchase_amount
|
||||||
erpnext.patches.v15_0.create_asset_depreciation_schedules_from_assets
|
erpnext.patches.v15_0.create_asset_depreciation_schedules_from_assets
|
||||||
execute:frappe.delete_doc_if_exists('Workspace', 'ERPNext Integrations Settings')
|
execute:frappe.delete_doc_if_exists('Workspace', 'ERPNext Integrations Settings')
|
||||||
erpnext.patches.v14_0.update_posting_datetime_and_dropped_indexes #22-02-2024
|
erpnext.patches.v14_0.update_posting_datetime_and_dropped_indexes #22-02-2024
|
||||||
|
|||||||
@@ -562,7 +562,7 @@ class TestLandedCostVoucher(IntegrationTestCase):
|
|||||||
self.assertEqual(entry.credit_in_account_currency, amounts[1])
|
self.assertEqual(entry.credit_in_account_currency, amounts[1])
|
||||||
|
|
||||||
def test_asset_lcv(self):
|
def test_asset_lcv(self):
|
||||||
"Check if LCV for an Asset updates the Assets Gross Purchase Amount correctly."
|
"Check if LCV for an Asset updates the Assets Net Purchase Amount correctly."
|
||||||
frappe.db.set_value(
|
frappe.db.set_value(
|
||||||
"Company", "_Test Company", "capital_work_in_progress_account", "CWIP Account - _TC"
|
"Company", "_Test Company", "capital_work_in_progress_account", "CWIP Account - _TC"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user