From 6e9b52d26864231b869964930e6a514f9745297a Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Fri, 7 Oct 2022 14:04:36 +0530 Subject: [PATCH 1/3] fix: Tax withholding related fixes (cherry picked from commit abf5b6be3ea13f0d00664e25e7b1742429d4f5e2) (cherry picked from commit 32a9575f07ebfb8ec807f1a5133d063de132ea67) --- .../tax_withholding_category/tax_withholding_category.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py index 7f79724f3bc..b4d72d6938f 100644 --- a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py +++ b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py @@ -419,7 +419,10 @@ def get_tds_amount(ldc, parties, inv, tax_details, tax_deducted, vouchers): ): # Get net total again as TDS is calculated on net total # Grand is used to just check for threshold breach - net_total = frappe.db.get_value("Purchase Invoice", invoice_filters, "sum(net_total)") or 0.0 + net_total = 0 + if vouchers: + net_total = frappe.db.get_value("Purchase Invoice", invoice_filters, "sum(net_total)") + net_total += inv.net_total supp_credit_amt = net_total - cumulative_threshold From be404b77a113bd3299348bf62fd8ed099e8896b1 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Fri, 7 Oct 2022 14:22:40 +0530 Subject: [PATCH 2/3] fix: Do not add tax withheld vouchers post tax withheding in one document (cherry picked from commit 781d160c684f9c04b1c799449e484abff3e07d8a) # Conflicts: # erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json (cherry picked from commit e1c41b91950e9a3df2e557ea220a71f3e2eebbe7) --- .../accounts/doctype/purchase_invoice/purchase_invoice.json | 5 +++++ .../tax_withholding_category/tax_withholding_category.py | 3 +++ 2 files changed, 8 insertions(+) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index ff3d5950808..10151e9e553 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -1428,6 +1428,7 @@ "fieldname": "tax_withheld_vouchers", "fieldtype": "Table", "label": "Tax Withheld Vouchers", + "no_copy": 1, "options": "Tax Withheld Vouchers", "read_only": 1 } @@ -1436,7 +1437,11 @@ "idx": 204, "is_submittable": 1, "links": [], +<<<<<<< HEAD "modified": "2022-09-13 23:39:54.525037", +======= + "modified": "2022-10-07 14:19:14.214157", +>>>>>>> 781d160c68 (fix: Do not add tax withheld vouchers post tax withheding in one document) "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice", diff --git a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py index b4d72d6938f..08ca96afb9f 100644 --- a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py +++ b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py @@ -240,6 +240,9 @@ def get_tax_amount(party_type, parties, inv, tax_details, posting_date, pan_no=N ) else: tax_amount = net_total * tax_details.rate / 100 if net_total > 0 else 0 + + # once tds is deducted, not need to add vouchers in the invoice + voucher_wise_amount = {} else: tax_amount = get_tds_amount(ldc, parties, inv, tax_details, tax_deducted, vouchers) From 611dd5c073d3366db8d3844e3fc1a090623284f9 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Fri, 7 Oct 2022 17:33:03 +0530 Subject: [PATCH 3/3] chore: resolve conflicts (cherry picked from commit 2bf76f64bd22ac88068c8d65b3d1e9ab3ee33719) --- .../accounts/doctype/purchase_invoice/purchase_invoice.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json index 10151e9e553..fdd68c6e3ad 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json @@ -1437,11 +1437,7 @@ "idx": 204, "is_submittable": 1, "links": [], -<<<<<<< HEAD - "modified": "2022-09-13 23:39:54.525037", -======= "modified": "2022-10-07 14:19:14.214157", ->>>>>>> 781d160c68 (fix: Do not add tax withheld vouchers post tax withheding in one document) "modified_by": "Administrator", "module": "Accounts", "name": "Purchase Invoice", @@ -1505,4 +1501,4 @@ "timeline_field": "supplier", "title_field": "title", "track_changes": 1 -} \ No newline at end of file +}