mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-09 00:01:18 +00:00
fix: TDS calculation on net total (#27058)
(cherry picked from commit 4eb7c2a011)
# Conflicts:
# erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
# erpnext/accounts/doctype/tax_withholding_category/test_tax_withholding_category.py
This commit is contained in:
@@ -551,6 +551,7 @@ def get_advance_tax_across_fiscal_year(tax_deducted_on_advances, tax_details):
|
|||||||
|
|
||||||
def get_tds_amount(ldc, parties, inv, tax_details, voucher_wise_amount):
|
def get_tds_amount(ldc, parties, inv, tax_details, voucher_wise_amount):
|
||||||
tds_amount = 0
|
tds_amount = 0
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
pi_grand_total = 0
|
pi_grand_total = 0
|
||||||
pi_base_net_total = 0
|
pi_base_net_total = 0
|
||||||
@@ -575,13 +576,25 @@ def get_tds_amount(ldc, parties, inv, tax_details, voucher_wise_amount):
|
|||||||
"posting_date": ["between", (tax_details.from_date, tax_details.to_date)],
|
"posting_date": ["between", (tax_details.from_date, tax_details.to_date)],
|
||||||
"tax_withholding_category": tax_details.get("tax_withholding_category"),
|
"tax_withholding_category": tax_details.get("tax_withholding_category"),
|
||||||
"company": inv.company,
|
"company": inv.company,
|
||||||
|
=======
|
||||||
|
invoice_filters = {
|
||||||
|
'name': ('in', vouchers),
|
||||||
|
'docstatus': 1,
|
||||||
|
'apply_tds': 1
|
||||||
|
>>>>>>> 4eb7c2a011 (fix: TDS calculation on net total (#27058))
|
||||||
}
|
}
|
||||||
|
|
||||||
consider_party_ledger_amt = cint(tax_details.consider_party_ledger_amount)
|
consider_party_ledger_amt = cint(tax_details.consider_party_ledger_amount)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
if consider_party_ledger_amt:
|
if consider_party_ledger_amt:
|
||||||
pe_filters.pop("apply_tax_withholding_amount", None)
|
pe_filters.pop("apply_tax_withholding_amount", None)
|
||||||
pe_filters.pop("tax_withholding_category", None)
|
pe_filters.pop("tax_withholding_category", None)
|
||||||
|
=======
|
||||||
|
if cint(tax_details.consider_party_ledger_amount):
|
||||||
|
invoice_filters.pop('apply_tds', None)
|
||||||
|
field = 'sum(grand_total)'
|
||||||
|
>>>>>>> 4eb7c2a011 (fix: TDS calculation on net total (#27058))
|
||||||
|
|
||||||
# Get Amount via payment entry
|
# Get Amount via payment entry
|
||||||
payment_entries = frappe.db.get_all(
|
payment_entries = frappe.db.get_all(
|
||||||
|
|||||||
@@ -294,10 +294,48 @@ class TestTaxWithholdingCategory(IntegrationTestCase):
|
|||||||
for d in reversed(invoices):
|
for d in reversed(invoices):
|
||||||
d.cancel()
|
d.cancel()
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
def test_tcs_on_unallocated_advance_payments(self):
|
def test_tcs_on_unallocated_advance_payments(self):
|
||||||
frappe.db.set_value(
|
frappe.db.set_value(
|
||||||
"Customer", "Test TCS Customer", "tax_withholding_category", "Cumulative Threshold TCS"
|
"Customer", "Test TCS Customer", "tax_withholding_category", "Cumulative Threshold TCS"
|
||||||
)
|
)
|
||||||
|
=======
|
||||||
|
def test_tds_calculation_on_net_total(self):
|
||||||
|
frappe.db.set_value("Supplier", "Test TDS Supplier4", "tax_withholding_category", "Cumulative Threshold TDS")
|
||||||
|
invoices = []
|
||||||
|
|
||||||
|
pi = create_purchase_invoice(supplier = "Test TDS Supplier4", rate = 20000, do_not_save=True)
|
||||||
|
pi.append('taxes', {
|
||||||
|
"category": "Total",
|
||||||
|
"charge_type": "Actual",
|
||||||
|
"account_head": '_Test Account VAT - _TC',
|
||||||
|
"cost_center": 'Main - _TC',
|
||||||
|
"tax_amount": 1000,
|
||||||
|
"description": "Test",
|
||||||
|
"add_deduct_tax": "Add"
|
||||||
|
|
||||||
|
})
|
||||||
|
pi.save()
|
||||||
|
pi.submit()
|
||||||
|
invoices.append(pi)
|
||||||
|
|
||||||
|
# Second Invoice will apply TDS checked
|
||||||
|
pi1 = create_purchase_invoice(supplier = "Test TDS Supplier4", rate = 20000)
|
||||||
|
pi1.submit()
|
||||||
|
invoices.append(pi1)
|
||||||
|
|
||||||
|
self.assertEqual(pi1.taxes[0].tax_amount, 4000)
|
||||||
|
|
||||||
|
#delete invoices to avoid clashing
|
||||||
|
for d in invoices:
|
||||||
|
d.cancel()
|
||||||
|
|
||||||
|
def cancel_invoices():
|
||||||
|
purchase_invoices = frappe.get_all("Purchase Invoice", {
|
||||||
|
'supplier': ['in', ['Test TDS Supplier', 'Test TDS Supplier1', 'Test TDS Supplier2']],
|
||||||
|
'docstatus': 1
|
||||||
|
}, pluck="name")
|
||||||
|
>>>>>>> 4eb7c2a011 (fix: TDS calculation on net total (#27058))
|
||||||
|
|
||||||
vouchers = []
|
vouchers = []
|
||||||
|
|
||||||
@@ -996,6 +1034,7 @@ def create_payment_entry(**args):
|
|||||||
|
|
||||||
def create_records():
|
def create_records():
|
||||||
# create a new suppliers
|
# create a new suppliers
|
||||||
|
<<<<<<< HEAD
|
||||||
for name in [
|
for name in [
|
||||||
"Test TDS Supplier",
|
"Test TDS Supplier",
|
||||||
"Test TDS Supplier1",
|
"Test TDS Supplier1",
|
||||||
@@ -1009,6 +1048,10 @@ def create_records():
|
|||||||
"Test LDC Supplier",
|
"Test LDC Supplier",
|
||||||
]:
|
]:
|
||||||
if frappe.db.exists("Supplier", name):
|
if frappe.db.exists("Supplier", name):
|
||||||
|
=======
|
||||||
|
for name in ['Test TDS Supplier', 'Test TDS Supplier1', 'Test TDS Supplier2', 'Test TDS Supplier3', 'Test TDS Supplier4']:
|
||||||
|
if frappe.db.exists('Supplier', name):
|
||||||
|
>>>>>>> 4eb7c2a011 (fix: TDS calculation on net total (#27058))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
frappe.get_doc(
|
frappe.get_doc(
|
||||||
|
|||||||
Reference in New Issue
Block a user