From 97124e92fa28ebb9dab4ca27af9fe94cd2359e13 Mon Sep 17 00:00:00 2001 From: Shreya Shah Date: Tue, 19 Jun 2018 10:46:41 +0530 Subject: [PATCH] [Fixes] Tax withholding category and Bank Guarantee (#14576) * Fetch withheld percentage * Set query for accounts on the basis of company * Fix bank guarantee error on submit * Remove errors caused by fields which are removed --- .../doctype/bank_guarantee/bank_guarantee.py | 2 +- .../tax_withholding_category.js | 13 +++++++++++-- erpnext/accounts/party.py | 2 +- .../party_tax_withholding_config.json | 10 ++++++++-- erpnext/regional/india/setup.py | 3 +-- 5 files changed, 22 insertions(+), 8 deletions(-) diff --git a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py index 1a62c42749..13ed5b6b94 100644 --- a/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py +++ b/erpnext/accounts/doctype/bank_guarantee/bank_guarantee.py @@ -17,7 +17,7 @@ class BankGuarantee(Document): frappe.throw(_("Enter the Bank Guarantee Number before submittting.")) if not self.name_of_beneficiary: frappe.throw(_("Enter the name of the Beneficiary before submittting.")) - if not self.name_of_bank: + if not self.bank: frappe.throw(_("Enter the name of the bank or lending institution before submittting.")) @frappe.whitelist() diff --git a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.js b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.js index da99a8d901..b8d6c9af3a 100644 --- a/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.js +++ b/erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.js @@ -2,7 +2,16 @@ // For license information, please see license.txt frappe.ui.form.on('Tax Withholding Category', { - refresh: function(frm) { - + setup: function(frm) { + frm.set_query("account", "accounts", function(doc, cdt, cdn) { + var child = locals[cdt][cdn]; + if (child.company) { + return { + filters: { + 'company': child.company + } + }; + } + }); } }); diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index bb7d55bc26..2cfca2451c 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -531,7 +531,7 @@ def set_tax_withholding_details(tax_mapper, ref_doc, tax_withholding_category=No tax_withholding = frappe.get_doc("Tax Withholding Category", tax_withholding_category) if tax_withholding.book_on_invoice and ref_doc.doctype=='Purchase Invoice' \ - or tax_withholding.book_on_advance and ref_doc.doctype in ('Payment Entry', 'Journal Entry'): + or ref_doc.doctype in ('Payment Entry', 'Journal Entry'): for account_detail in tax_withholding.accounts: if ref_doc.company == account_detail.company: diff --git a/erpnext/buying/doctype/party_tax_withholding_config/party_tax_withholding_config.json b/erpnext/buying/doctype/party_tax_withholding_config/party_tax_withholding_config.json index 320485b318..d2583e5dcd 100644 --- a/erpnext/buying/doctype/party_tax_withholding_config/party_tax_withholding_config.json +++ b/erpnext/buying/doctype/party_tax_withholding_config/party_tax_withholding_config.json @@ -14,6 +14,7 @@ "fields": [ { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -46,6 +47,7 @@ }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -77,10 +79,12 @@ }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, "columns": 0, + "fetch_from": "tax_withholding_category.percent_of_tax_withheld", "fieldname": "applicable_percent", "fieldtype": "Float", "hidden": 0, @@ -108,6 +112,7 @@ }, { "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, "allow_on_submit": 0, "bold": 0, "collapsible": 0, @@ -148,7 +153,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2018-05-11 13:35:44.424855", + "modified": "2018-06-18 22:38:38.638721", "modified_by": "Administrator", "module": "Buying", "name": "Party Tax Withholding Config", @@ -162,5 +167,6 @@ "sort_field": "modified", "sort_order": "DESC", "track_changes": 1, - "track_seen": 0 + "track_seen": 0, + "track_views": 0 } \ No newline at end of file diff --git a/erpnext/regional/india/setup.py b/erpnext/regional/india/setup.py index 1a28f7757e..53299e0ae8 100644 --- a/erpnext/regional/india/setup.py +++ b/erpnext/regional/india/setup.py @@ -284,8 +284,7 @@ def set_tax_withholding_category(docs, company): { 'doctype': 'Tax Withholding Category', '__newname': 'TDS', 'percent_of_tax_withheld': 10,'threshold': 150000, 'book_on_invoice': 1, - 'book_on_advance': 0, "withhold_cumulative_tax_amount": 0, - 'accounts': accounts + 'withhold_cumulative_tax_amount': 0, 'accounts': accounts } ])