Merge branch 'develop' into refactor/qb/pick-list
This commit is contained in:
commit
eee3bd2554
@ -137,8 +137,7 @@
|
|||||||
"fieldname": "finance_book",
|
"fieldname": "finance_book",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Finance Book",
|
"label": "Finance Book",
|
||||||
"options": "Finance Book",
|
"options": "Finance Book"
|
||||||
"read_only": 1
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "2_add_edit_gl_entries",
|
"fieldname": "2_add_edit_gl_entries",
|
||||||
@ -539,7 +538,7 @@
|
|||||||
"idx": 176,
|
"idx": 176,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2022-11-28 17:40:01.241908",
|
"modified": "2023-01-17 12:53:53.280620",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Journal Entry",
|
"name": "Journal Entry",
|
||||||
|
@ -259,9 +259,7 @@ def get_tax_amount(party_type, parties, inv, tax_details, posting_date, pan_no=N
|
|||||||
if tax_deducted:
|
if tax_deducted:
|
||||||
net_total = inv.tax_withholding_net_total
|
net_total = inv.tax_withholding_net_total
|
||||||
if ldc:
|
if ldc:
|
||||||
tax_amount = get_tds_amount_from_ldc(
|
tax_amount = get_tds_amount_from_ldc(ldc, parties, tax_details, posting_date, net_total)
|
||||||
ldc, parties, pan_no, tax_details, posting_date, net_total
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
tax_amount = net_total * tax_details.rate / 100 if net_total > 0 else 0
|
tax_amount = net_total * tax_details.rate / 100 if net_total > 0 else 0
|
||||||
|
|
||||||
@ -538,7 +536,7 @@ def get_invoice_total_without_tcs(inv, tax_details):
|
|||||||
return inv.grand_total - tcs_tax_row_amount
|
return inv.grand_total - tcs_tax_row_amount
|
||||||
|
|
||||||
|
|
||||||
def get_tds_amount_from_ldc(ldc, parties, pan_no, tax_details, posting_date, net_total):
|
def get_tds_amount_from_ldc(ldc, parties, tax_details, posting_date, net_total):
|
||||||
tds_amount = 0
|
tds_amount = 0
|
||||||
limit_consumed = frappe.db.get_value(
|
limit_consumed = frappe.db.get_value(
|
||||||
"Purchase Invoice",
|
"Purchase Invoice",
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
|
from frappe.utils import flt
|
||||||
|
|
||||||
|
|
||||||
def execute(filters=None):
|
def execute(filters=None):
|
||||||
@ -65,6 +66,12 @@ def get_result(
|
|||||||
else:
|
else:
|
||||||
total_amount_credited += entry.credit
|
total_amount_credited += entry.credit
|
||||||
|
|
||||||
|
## Check if ldc is applied and show rate as per ldc
|
||||||
|
actual_rate = (tds_deducted / total_amount_credited) * 100
|
||||||
|
|
||||||
|
if flt(actual_rate) < flt(rate):
|
||||||
|
rate = actual_rate
|
||||||
|
|
||||||
if tds_deducted:
|
if tds_deducted:
|
||||||
row = {
|
row = {
|
||||||
"pan"
|
"pan"
|
||||||
|
@ -135,6 +135,10 @@ frappe.ui.form.on('Asset', {
|
|||||||
}, __("Manage"));
|
}, __("Manage"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (frm.doc.depr_entry_posting_status === "Failed") {
|
||||||
|
frm.trigger("set_depr_posting_failure_alert");
|
||||||
|
}
|
||||||
|
|
||||||
frm.trigger("setup_chart");
|
frm.trigger("setup_chart");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,6 +149,19 @@ frappe.ui.form.on('Asset', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
set_depr_posting_failure_alert: function (frm) {
|
||||||
|
const alert = `
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12 col-sm-6">
|
||||||
|
<span class="indicator whitespace-nowrap red">
|
||||||
|
<span>Failed to post depreciation entries</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>`;
|
||||||
|
|
||||||
|
frm.dashboard.set_headline_alert(alert);
|
||||||
|
},
|
||||||
|
|
||||||
toggle_reference_doc: function(frm) {
|
toggle_reference_doc: function(frm) {
|
||||||
if (frm.doc.purchase_receipt && frm.doc.purchase_invoice && frm.doc.docstatus === 1) {
|
if (frm.doc.purchase_receipt && frm.doc.purchase_invoice && frm.doc.docstatus === 1) {
|
||||||
frm.set_df_property('purchase_invoice', 'read_only', 1);
|
frm.set_df_property('purchase_invoice', 'read_only', 1);
|
||||||
|
@ -68,6 +68,7 @@
|
|||||||
"column_break_51",
|
"column_break_51",
|
||||||
"purchase_receipt_amount",
|
"purchase_receipt_amount",
|
||||||
"default_finance_book",
|
"default_finance_book",
|
||||||
|
"depr_entry_posting_status",
|
||||||
"amended_from"
|
"amended_from"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
@ -473,6 +474,16 @@
|
|||||||
"fieldtype": "Int",
|
"fieldtype": "Int",
|
||||||
"label": "Asset Quantity",
|
"label": "Asset Quantity",
|
||||||
"read_only_depends_on": "eval:!doc.is_existing_asset"
|
"read_only_depends_on": "eval:!doc.is_existing_asset"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "depr_entry_posting_status",
|
||||||
|
"fieldtype": "Select",
|
||||||
|
"hidden": 1,
|
||||||
|
"label": "Depreciation Entry Posting Status",
|
||||||
|
"no_copy": 1,
|
||||||
|
"options": "\nSuccessful\nFailed",
|
||||||
|
"print_hide": 1,
|
||||||
|
"read_only": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"idx": 72,
|
"idx": 72,
|
||||||
@ -487,7 +498,7 @@
|
|||||||
{
|
{
|
||||||
"group": "Repair",
|
"group": "Repair",
|
||||||
"link_doctype": "Asset Repair",
|
"link_doctype": "Asset Repair",
|
||||||
"link_fieldname": "asset_name"
|
"link_fieldname": "asset"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"group": "Value",
|
"group": "Value",
|
||||||
@ -500,7 +511,7 @@
|
|||||||
"link_fieldname": "asset"
|
"link_fieldname": "asset"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2022-11-25 12:47:19.689702",
|
"modified": "2023-01-17 00:25:30.387242",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Assets",
|
"module": "Assets",
|
||||||
"name": "Asset",
|
"name": "Asset",
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils import add_months, cint, flt, get_link_to_form, getdate, nowdate, today
|
from frappe.utils import add_months, cint, flt, get_link_to_form, getdate, nowdate, today
|
||||||
|
from frappe.utils.user import get_users_with_role
|
||||||
|
|
||||||
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
|
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
|
||||||
get_checks_for_pl_and_bs_accounts,
|
get_checks_for_pl_and_bs_accounts,
|
||||||
@ -18,7 +19,7 @@ from erpnext.assets.doctype.asset_depreciation_schedule.asset_depreciation_sched
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def post_depreciation_entries(date=None, commit=True):
|
def post_depreciation_entries(date=None):
|
||||||
# Return if automatic booking of asset depreciation is disabled
|
# Return if automatic booking of asset depreciation is disabled
|
||||||
if not cint(
|
if not cint(
|
||||||
frappe.db.get_value("Accounts Settings", None, "book_asset_depreciation_entry_automatically")
|
frappe.db.get_value("Accounts Settings", None, "book_asset_depreciation_entry_automatically")
|
||||||
@ -27,13 +28,24 @@ def post_depreciation_entries(date=None, commit=True):
|
|||||||
|
|
||||||
if not date:
|
if not date:
|
||||||
date = today()
|
date = today()
|
||||||
|
|
||||||
|
failed_asset_names = []
|
||||||
|
|
||||||
for asset_name in get_depreciable_assets(date):
|
for asset_name in get_depreciable_assets(date):
|
||||||
asset_doc = frappe.get_doc("Asset", asset_name)
|
asset_doc = frappe.get_doc("Asset", asset_name)
|
||||||
|
|
||||||
make_depreciation_entry_for_all_asset_depr_schedules(asset_doc, date)
|
try:
|
||||||
|
make_depreciation_entry_for_all_asset_depr_schedules(asset_doc, date)
|
||||||
if commit:
|
|
||||||
frappe.db.commit()
|
frappe.db.commit()
|
||||||
|
except Exception as e:
|
||||||
|
frappe.db.rollback()
|
||||||
|
failed_asset_names.append(asset_name)
|
||||||
|
|
||||||
|
if failed_asset_names:
|
||||||
|
set_depr_entry_posting_status_for_failed_assets(failed_asset_names)
|
||||||
|
notify_depr_entry_posting_error(failed_asset_names)
|
||||||
|
|
||||||
|
frappe.db.commit()
|
||||||
|
|
||||||
|
|
||||||
def get_depreciable_assets(date):
|
def get_depreciable_assets(date):
|
||||||
@ -146,6 +158,8 @@ def make_depreciation_entry(asset_depr_schedule_name, date=None):
|
|||||||
row.value_after_depreciation -= d.depreciation_amount
|
row.value_after_depreciation -= d.depreciation_amount
|
||||||
row.db_update()
|
row.db_update()
|
||||||
|
|
||||||
|
frappe.db.set_value("Asset", asset_name, "depr_entry_posting_status", "Successful")
|
||||||
|
|
||||||
asset.set_status()
|
asset.set_status()
|
||||||
|
|
||||||
return asset_depr_schedule_doc
|
return asset_depr_schedule_doc
|
||||||
@ -209,6 +223,42 @@ def get_credit_and_debit_accounts(accumulated_depreciation_account, depreciation
|
|||||||
return credit_account, debit_account
|
return credit_account, debit_account
|
||||||
|
|
||||||
|
|
||||||
|
def set_depr_entry_posting_status_for_failed_assets(failed_asset_names):
|
||||||
|
for asset_name in failed_asset_names:
|
||||||
|
frappe.db.set_value("Asset", asset_name, "depr_entry_posting_status", "Failed")
|
||||||
|
|
||||||
|
|
||||||
|
def notify_depr_entry_posting_error(failed_asset_names):
|
||||||
|
recipients = get_users_with_role("Accounts Manager")
|
||||||
|
|
||||||
|
if not recipients:
|
||||||
|
recipients = get_users_with_role("System Manager")
|
||||||
|
|
||||||
|
subject = _("Error while posting depreciation entries")
|
||||||
|
|
||||||
|
asset_links = get_comma_separated_asset_links(failed_asset_names)
|
||||||
|
|
||||||
|
message = (
|
||||||
|
_("Hi,")
|
||||||
|
+ "<br>"
|
||||||
|
+ _("The following assets have failed to post depreciation entries: {0}").format(asset_links)
|
||||||
|
+ "."
|
||||||
|
)
|
||||||
|
|
||||||
|
frappe.sendmail(recipients=recipients, subject=subject, message=message)
|
||||||
|
|
||||||
|
|
||||||
|
def get_comma_separated_asset_links(asset_names):
|
||||||
|
asset_links = []
|
||||||
|
|
||||||
|
for asset_name in asset_names:
|
||||||
|
asset_links.append(get_link_to_form("Asset", asset_name))
|
||||||
|
|
||||||
|
asset_links = ", ".join(asset_links)
|
||||||
|
|
||||||
|
return asset_links
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def scrap_asset(asset_name):
|
def scrap_asset(asset_name):
|
||||||
asset = frappe.get_doc("Asset", asset_name)
|
asset = frappe.get_doc("Asset", asset_name)
|
||||||
@ -295,12 +345,12 @@ def reset_depreciation_schedule(asset_doc, date, notes):
|
|||||||
asset_doc, notes, date_of_return=date
|
asset_doc, notes, date_of_return=date
|
||||||
)
|
)
|
||||||
|
|
||||||
modify_depreciation_schedule_for_asset_repairs(asset_doc)
|
modify_depreciation_schedule_for_asset_repairs(asset_doc, notes)
|
||||||
|
|
||||||
asset_doc.save()
|
asset_doc.save()
|
||||||
|
|
||||||
|
|
||||||
def modify_depreciation_schedule_for_asset_repairs(asset):
|
def modify_depreciation_schedule_for_asset_repairs(asset, notes):
|
||||||
asset_repairs = frappe.get_all(
|
asset_repairs = frappe.get_all(
|
||||||
"Asset Repair", filters={"asset": asset.name}, fields=["name", "increase_in_asset_life"]
|
"Asset Repair", filters={"asset": asset.name}, fields=["name", "increase_in_asset_life"]
|
||||||
)
|
)
|
||||||
@ -309,10 +359,6 @@ def modify_depreciation_schedule_for_asset_repairs(asset):
|
|||||||
if repair.increase_in_asset_life:
|
if repair.increase_in_asset_life:
|
||||||
asset_repair = frappe.get_doc("Asset Repair", repair.name)
|
asset_repair = frappe.get_doc("Asset Repair", repair.name)
|
||||||
asset_repair.modify_depreciation_schedule()
|
asset_repair.modify_depreciation_schedule()
|
||||||
notes = _("This schedule was created when Asset {0} went through Asset Repair {1}.").format(
|
|
||||||
get_link_to_form(asset.doctype, asset.name),
|
|
||||||
get_link_to_form(asset_repair.doctype, asset_repair.name),
|
|
||||||
)
|
|
||||||
make_new_active_asset_depr_schedules_and_cancel_current_ones(asset, notes)
|
make_new_active_asset_depr_schedules_and_cancel_current_ones(asset, notes)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1549,6 +1549,7 @@ def create_asset(**args):
|
|||||||
"asset_owner": args.asset_owner or "Company",
|
"asset_owner": args.asset_owner or "Company",
|
||||||
"is_existing_asset": args.is_existing_asset or 1,
|
"is_existing_asset": args.is_existing_asset or 1,
|
||||||
"asset_quantity": args.get("asset_quantity") or 1,
|
"asset_quantity": args.get("asset_quantity") or 1,
|
||||||
|
"depr_entry_posting_status": args.depr_entry_posting_status or "",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -430,7 +430,7 @@ class AssetCapitalization(StockController):
|
|||||||
|
|
||||||
if asset.calculate_depreciation:
|
if asset.calculate_depreciation:
|
||||||
notes = _(
|
notes = _(
|
||||||
"This schedule was created when Asset {0} was consumed when Asset Capitalization {1} was submitted."
|
"This schedule was created when Asset {0} was consumed through Asset Capitalization {1}."
|
||||||
).format(
|
).format(
|
||||||
get_link_to_form(asset.doctype, asset.name), get_link_to_form(self.doctype, self.get("name"))
|
get_link_to_form(asset.doctype, asset.name), get_link_to_form(self.doctype, self.get("name"))
|
||||||
)
|
)
|
||||||
@ -521,7 +521,7 @@ class AssetCapitalization(StockController):
|
|||||||
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_receipt_amount = total_target_asset_value
|
||||||
notes = _(
|
notes = _(
|
||||||
"This schedule was created when target Asset {0} was updated when Asset Capitalization {1} was submitted."
|
"This schedule was created when target Asset {0} was updated through Asset Capitalization {1}."
|
||||||
).format(
|
).format(
|
||||||
get_link_to_form(asset_doc.doctype, asset_doc.name), get_link_to_form(self.doctype, self.name)
|
get_link_to_form(asset_doc.doctype, asset_doc.name), get_link_to_form(self.doctype, self.name)
|
||||||
)
|
)
|
||||||
@ -537,7 +537,7 @@ class AssetCapitalization(StockController):
|
|||||||
if asset.calculate_depreciation:
|
if asset.calculate_depreciation:
|
||||||
reverse_depreciation_entry_made_after_disposal(asset, self.posting_date)
|
reverse_depreciation_entry_made_after_disposal(asset, self.posting_date)
|
||||||
notes = _(
|
notes = _(
|
||||||
"This schedule was created when Asset {0} was restored when Asset Capitalization {1} was cancelled."
|
"This schedule was created when Asset {0} was restored on Asset Capitalization {1}'s cancellation."
|
||||||
).format(
|
).format(
|
||||||
get_link_to_form(asset.doctype, asset.name), get_link_to_form(self.doctype, self.name)
|
get_link_to_form(asset.doctype, asset.name), get_link_to_form(self.doctype, self.name)
|
||||||
)
|
)
|
||||||
|
@ -159,7 +159,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2023-01-02 15:38:30.766779",
|
"modified": "2023-01-16 21:08:21.421260",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Assets",
|
"module": "Assets",
|
||||||
"name": "Asset Depreciation Schedule",
|
"name": "Asset Depreciation Schedule",
|
||||||
|
@ -56,8 +56,11 @@ class AssetRepair(AccountsController):
|
|||||||
):
|
):
|
||||||
self.modify_depreciation_schedule()
|
self.modify_depreciation_schedule()
|
||||||
|
|
||||||
notes = _("This schedule was created when Asset Repair {0} was submitted.").format(
|
notes = _(
|
||||||
get_link_to_form(self.doctype, self.name)
|
"This schedule was created when Asset {0} was repaired through Asset Repair {1}."
|
||||||
|
).format(
|
||||||
|
get_link_to_form(self.asset_doc.doctype, self.asset_doc.name),
|
||||||
|
get_link_to_form(self.doctype, self.name),
|
||||||
)
|
)
|
||||||
self.asset_doc.flags.ignore_validate_update_after_submit = True
|
self.asset_doc.flags.ignore_validate_update_after_submit = True
|
||||||
make_new_active_asset_depr_schedules_and_cancel_current_ones(self.asset_doc, notes)
|
make_new_active_asset_depr_schedules_and_cancel_current_ones(self.asset_doc, notes)
|
||||||
@ -80,8 +83,9 @@ class AssetRepair(AccountsController):
|
|||||||
):
|
):
|
||||||
self.revert_depreciation_schedule_on_cancellation()
|
self.revert_depreciation_schedule_on_cancellation()
|
||||||
|
|
||||||
notes = _("This schedule was created when Asset Repair {0} was cancelled.").format(
|
notes = _("This schedule was created when Asset {0}'s Asset Repair {1} was cancelled.").format(
|
||||||
get_link_to_form(self.doctype, self.name)
|
get_link_to_form(self.asset_doc.doctype, self.asset_doc.name),
|
||||||
|
get_link_to_form(self.doctype, self.name),
|
||||||
)
|
)
|
||||||
self.asset_doc.flags.ignore_validate_update_after_submit = True
|
self.asset_doc.flags.ignore_validate_update_after_submit = True
|
||||||
make_new_active_asset_depr_schedules_and_cancel_current_ones(self.asset_doc, notes)
|
make_new_active_asset_depr_schedules_and_cancel_current_ones(self.asset_doc, notes)
|
||||||
|
@ -127,12 +127,20 @@ class AssetValueAdjustment(Document):
|
|||||||
current_asset_depr_schedule_doc.flags.should_not_cancel_depreciation_entries = True
|
current_asset_depr_schedule_doc.flags.should_not_cancel_depreciation_entries = True
|
||||||
current_asset_depr_schedule_doc.cancel()
|
current_asset_depr_schedule_doc.cancel()
|
||||||
|
|
||||||
notes = _(
|
if self.docstatus == 1:
|
||||||
"This schedule was created when Asset {0} was adjusted through Asset Value Adjustment {1}."
|
notes = _(
|
||||||
).format(
|
"This schedule was created when Asset {0} was adjusted through Asset Value Adjustment {1}."
|
||||||
get_link_to_form(asset.doctype, asset.name),
|
).format(
|
||||||
get_link_to_form(self.get("doctype"), self.get("name")),
|
get_link_to_form(asset.doctype, asset.name),
|
||||||
)
|
get_link_to_form(self.get("doctype"), self.get("name")),
|
||||||
|
)
|
||||||
|
elif self.docstatus == 2:
|
||||||
|
notes = _(
|
||||||
|
"This schedule was created when Asset {0}'s Asset Value Adjustment {1} was cancelled."
|
||||||
|
).format(
|
||||||
|
get_link_to_form(asset.doctype, asset.name),
|
||||||
|
get_link_to_form(self.get("doctype"), self.get("name")),
|
||||||
|
)
|
||||||
new_asset_depr_schedule_doc.notes = notes
|
new_asset_depr_schedule_doc.notes = notes
|
||||||
|
|
||||||
new_asset_depr_schedule_doc.insert()
|
new_asset_depr_schedule_doc.insert()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
frappe.provide("erpnext.accounts.bank_reconciliation");
|
frappe.provide("erpnext.accounts.bank_reconciliation");
|
||||||
|
|
||||||
erpnext.accounts.bank_reconciliation.DialogManager = class DialogManager {
|
erpnext.accounts.bank_reconciliation.DialogManager = class DialogManager {
|
||||||
constructor(company, bank_account) {
|
constructor(company, bank_account, bank_statement_from_date, bank_statement_to_date, filter_by_reference_date, from_reference_date, to_reference_date) {
|
||||||
this.bank_account = bank_account;
|
this.bank_account = bank_account;
|
||||||
this.company = company;
|
this.company = company;
|
||||||
this.make_dialog();
|
this.make_dialog();
|
||||||
|
Loading…
Reference in New Issue
Block a user