fix: Add company field to lower deduction certificate (#34914)

This commit is contained in:
Deepesh Garg 2023-04-25 19:07:45 +05:30 committed by GitHub
parent 6de71eb158
commit b545e3def0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 3 deletions

View File

@ -215,7 +215,7 @@ def get_tax_row_for_tds(tax_details, tax_amount):
} }
def get_lower_deduction_certificate(tax_details, pan_no): def get_lower_deduction_certificate(company, tax_details, pan_no):
ldc_name = frappe.db.get_value( ldc_name = frappe.db.get_value(
"Lower Deduction Certificate", "Lower Deduction Certificate",
{ {
@ -223,6 +223,7 @@ def get_lower_deduction_certificate(tax_details, pan_no):
"tax_withholding_category": tax_details.tax_withholding_category, "tax_withholding_category": tax_details.tax_withholding_category,
"valid_from": (">=", tax_details.from_date), "valid_from": (">=", tax_details.from_date),
"valid_upto": ("<=", tax_details.to_date), "valid_upto": ("<=", tax_details.to_date),
"company": company,
}, },
"name", "name",
) )
@ -255,7 +256,7 @@ def get_tax_amount(party_type, parties, inv, tax_details, posting_date, pan_no=N
tax_amount = 0 tax_amount = 0
if party_type == "Supplier": if party_type == "Supplier":
ldc = get_lower_deduction_certificate(tax_details, pan_no) ldc = get_lower_deduction_certificate(inv.company, tax_details, pan_no)
if tax_deducted: if tax_deducted:
net_total = inv.tax_withholding_net_total net_total = inv.tax_withholding_net_total
if ldc: if ldc:

View File

@ -332,3 +332,4 @@ execute:frappe.db.set_single_value("Accounts Settings", "merge_similar_account_h
erpnext.patches.v14_0.migrate_gl_to_payment_ledger erpnext.patches.v14_0.migrate_gl_to_payment_ledger
execute:frappe.delete_doc_if_exists("Report", "Tax Detail") execute:frappe.delete_doc_if_exists("Report", "Tax Detail")
erpnext.patches.v15_0.enable_all_leads erpnext.patches.v15_0.enable_all_leads
erpnext.patches.v14_0.update_company_in_ldc

View File

@ -0,0 +1,14 @@
# Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import frappe
from erpnext import get_default_company
def execute():
company = get_default_company()
if company:
for d in frappe.get_all("Lower Deduction Certificate", pluck="name"):
frappe.db.set_value("Lower Deduction Certificate", d, "company", company, update_modified=False)

View File

@ -10,6 +10,7 @@
"tax_withholding_category", "tax_withholding_category",
"fiscal_year", "fiscal_year",
"column_break_3", "column_break_3",
"company",
"certificate_no", "certificate_no",
"section_break_3", "section_break_3",
"supplier", "supplier",
@ -123,11 +124,18 @@
"label": "Tax Withholding Category", "label": "Tax Withholding Category",
"options": "Tax Withholding Category", "options": "Tax Withholding Category",
"reqd": 1 "reqd": 1
},
{
"fieldname": "company",
"fieldtype": "Link",
"label": "Company",
"options": "Company",
"reqd": 1
} }
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2021-10-23 18:33:38.962622", "modified": "2023-04-18 08:25:35.302081",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Regional", "module": "Regional",
"name": "Lower Deduction Certificate", "name": "Lower Deduction Certificate",
@ -136,5 +144,6 @@
"permissions": [], "permissions": [],
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"states": [],
"track_changes": 1 "track_changes": 1
} }