mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-27 18:48:31 +00:00
fix: disposal_was_made_on_original_schedule_date
This commit is contained in:
@@ -26,6 +26,7 @@ from erpnext.accounts.general_ledger import make_reverse_gl_entries
|
|||||||
from erpnext.assets.doctype.asset.depreciation import (
|
from erpnext.assets.doctype.asset.depreciation import (
|
||||||
get_depreciation_accounts,
|
get_depreciation_accounts,
|
||||||
get_disposal_account_and_cost_center,
|
get_disposal_account_and_cost_center,
|
||||||
|
is_last_day_of_the_month,
|
||||||
)
|
)
|
||||||
from erpnext.assets.doctype.asset_category.asset_category import get_asset_category_account
|
from erpnext.assets.doctype.asset_category.asset_category import get_asset_category_account
|
||||||
from erpnext.controllers.accounts_controller import AccountsController
|
from erpnext.controllers.accounts_controller import AccountsController
|
||||||
@@ -1083,12 +1084,6 @@ def get_total_days(date, frequency):
|
|||||||
return date_diff(date, period_start_date)
|
return date_diff(date, period_start_date)
|
||||||
|
|
||||||
|
|
||||||
def is_last_day_of_the_month(date):
|
|
||||||
last_day_of_the_month = get_last_day(date)
|
|
||||||
|
|
||||||
return getdate(last_day_of_the_month) == getdate(date)
|
|
||||||
|
|
||||||
|
|
||||||
@erpnext.allow_regional
|
@erpnext.allow_regional
|
||||||
def get_depreciation_amount(asset, depreciable_value, row):
|
def get_depreciation_amount(asset, depreciable_value, row):
|
||||||
if row.depreciation_method in ("Straight Line", "Manual"):
|
if row.depreciation_method in ("Straight Line", "Manual"):
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils import add_months, cint, flt, getdate, nowdate, today
|
from frappe.utils import add_months, cint, flt, get_last_day, getdate, nowdate, today
|
||||||
from frappe.utils.data import get_link_to_form
|
from frappe.utils.data import get_link_to_form
|
||||||
from frappe.utils.user import get_users_with_role
|
from frappe.utils.user import get_users_with_role
|
||||||
|
|
||||||
@@ -372,6 +372,9 @@ def disposal_was_made_on_original_schedule_date(asset, schedule, row, posting_da
|
|||||||
finance_book.depreciation_start_date, row * cint(finance_book.frequency_of_depreciation)
|
finance_book.depreciation_start_date, row * cint(finance_book.frequency_of_depreciation)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if is_last_day_of_the_month(finance_book.depreciation_start_date):
|
||||||
|
orginal_schedule_date = get_last_day(orginal_schedule_date)
|
||||||
|
|
||||||
if orginal_schedule_date == posting_date_of_disposal:
|
if orginal_schedule_date == posting_date_of_disposal:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
@@ -575,3 +578,9 @@ def get_value_after_depreciation_on_disposal_date(asset, disposal_date, finance_
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return flt(asset_doc.value_after_depreciation)
|
return flt(asset_doc.value_after_depreciation)
|
||||||
|
|
||||||
|
|
||||||
|
def is_last_day_of_the_month(date):
|
||||||
|
last_day_of_the_month = get_last_day(date)
|
||||||
|
|
||||||
|
return getdate(last_day_of_the_month) == getdate(date)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ from erpnext.assets.doctype.asset.asset import (
|
|||||||
update_maintenance_status,
|
update_maintenance_status,
|
||||||
)
|
)
|
||||||
from erpnext.assets.doctype.asset.depreciation import (
|
from erpnext.assets.doctype.asset.depreciation import (
|
||||||
|
is_last_day_of_the_month,
|
||||||
post_depreciation_entries,
|
post_depreciation_entries,
|
||||||
restore_asset,
|
restore_asset,
|
||||||
scrap_asset,
|
scrap_asset,
|
||||||
@@ -1577,9 +1578,3 @@ def set_depreciation_settings_in_company(company=None):
|
|||||||
|
|
||||||
def enable_cwip_accounting(asset_category, enable=1):
|
def enable_cwip_accounting(asset_category, enable=1):
|
||||||
frappe.db.set_value("Asset Category", asset_category, "enable_cwip_accounting", enable)
|
frappe.db.set_value("Asset Category", asset_category, "enable_cwip_accounting", enable)
|
||||||
|
|
||||||
|
|
||||||
def is_last_day_of_the_month(dt):
|
|
||||||
last_day_of_the_month = get_last_day(dt)
|
|
||||||
|
|
||||||
return getdate(dt) == getdate(last_day_of_the_month)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user