[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
This commit is contained in:
Shreya Shah 2018-06-19 10:46:41 +05:30 committed by Nabin Hait
parent cbff30f718
commit 97124e92fa
5 changed files with 22 additions and 8 deletions

View File

@ -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()

View File

@ -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
}
};
}
});
}
});

View File

@ -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:

View File

@ -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
}

View File

@ -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
}
])