fix(minor): Filters and fixes in Tax Withholding Category
This commit is contained in:
parent
2849297471
commit
7733afc0ae
@ -8,7 +8,8 @@ frappe.ui.form.on('Tax Withholding Category', {
|
||||
if (child.company) {
|
||||
return {
|
||||
filters: {
|
||||
'company': child.company
|
||||
'company': child.company,
|
||||
'root_type': ['in', ['Asset', 'Liability']]
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ from frappe.utils import cint, getdate
|
||||
class TaxWithholdingCategory(Document):
|
||||
def validate(self):
|
||||
self.validate_dates()
|
||||
self.validate_accounts()
|
||||
self.validate_thresholds()
|
||||
|
||||
def validate_dates(self):
|
||||
@ -25,6 +26,14 @@ class TaxWithholdingCategory(Document):
|
||||
if last_date and getdate(d.to_date) < getdate(last_date):
|
||||
frappe.throw(_("Row #{0}: Dates overlapping with other row").format(d.idx))
|
||||
|
||||
def validate_accounts(self):
|
||||
existing_accounts = []
|
||||
for d in self.get('accounts'):
|
||||
if d.get('account') in existing_accounts:
|
||||
frappe.throw(_("Account {0} added multiple times").format(frappe.bold(d.get('account'))))
|
||||
|
||||
existing_accounts.append(d.get('account'))
|
||||
|
||||
def validate_thresholds(self):
|
||||
for d in self.get('rates'):
|
||||
if d.cumulative_threshold and d.cumulative_threshold < d.single_threshold:
|
||||
|
Loading…
Reference in New Issue
Block a user