Bootstrap 'TDS' via fixture
This commit is contained in:
parent
d9faba962b
commit
2d8a7ee81f
@ -139,6 +139,9 @@
|
|||||||
"Creditors": {
|
"Creditors": {
|
||||||
"account_type": "Payable"
|
"account_type": "Payable"
|
||||||
},
|
},
|
||||||
|
"TDS": {
|
||||||
|
"account_type": "Payable"
|
||||||
|
},
|
||||||
"Payroll Payable": {}
|
"Payroll Payable": {}
|
||||||
},
|
},
|
||||||
"Stock Liabilities": {
|
"Stock Liabilities": {
|
||||||
|
@ -2766,7 +2766,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2018-05-10 07:52:24.326361",
|
"modified": "2018-05-11 12:48:46.435484",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Employee",
|
"name": "Employee",
|
||||||
|
@ -16,7 +16,7 @@ def setup(company=None, patch=True):
|
|||||||
add_print_formats()
|
add_print_formats()
|
||||||
if not patch:
|
if not patch:
|
||||||
update_address_template()
|
update_address_template()
|
||||||
make_fixtures()
|
make_fixtures(company)
|
||||||
|
|
||||||
def update_address_template():
|
def update_address_template():
|
||||||
with open(os.path.join(os.path.dirname(__file__), 'address_template.html'), 'r') as f:
|
with open(os.path.join(os.path.dirname(__file__), 'address_template.html'), 'r') as f:
|
||||||
@ -189,15 +189,13 @@ def make_custom_fields():
|
|||||||
|
|
||||||
create_custom_fields(custom_fields, ignore_validate = frappe.flags.in_patch)
|
create_custom_fields(custom_fields, ignore_validate = frappe.flags.in_patch)
|
||||||
|
|
||||||
def make_fixtures():
|
def make_fixtures(company=None):
|
||||||
docs = [
|
docs = []
|
||||||
{'doctype': 'Salary Component', 'salary_component': 'Professional Tax', 'description': 'Professional Tax', 'type': 'Deduction'},
|
company = company.name if company else frappe.db.get_value("Global Defaults", None, "default_company")
|
||||||
{'doctype': 'Salary Component', 'salary_component': 'Provident Fund', 'description': 'Provident fund', 'type': 'Deduction'},
|
|
||||||
{'doctype': 'Salary Component', 'salary_component': 'House Rent Allowance', 'description': 'House Rent Allowance', 'type': 'Earning'},
|
set_salary_components(docs)
|
||||||
{'doctype': 'Salary Component', 'salary_component': 'Basic', 'description': 'Basic', 'type': 'Earning'},
|
set_tds_account(docs, company)
|
||||||
{'doctype': 'Salary Component', 'salary_component': 'Arrear', 'description': 'Arrear', 'type': 'Earning'},
|
set_tax_withholding_category(docs, company)
|
||||||
{'doctype': 'Salary Component', 'salary_component': 'Leave Encashment', 'description': 'Leave Encashment', 'type': 'Earning'}
|
|
||||||
]
|
|
||||||
|
|
||||||
for d in docs:
|
for d in docs:
|
||||||
try:
|
try:
|
||||||
@ -206,3 +204,43 @@ def make_fixtures():
|
|||||||
doc.insert()
|
doc.insert()
|
||||||
except frappe.NameError:
|
except frappe.NameError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def set_salary_components(docs):
|
||||||
|
docs.extend([
|
||||||
|
{'doctype': 'Salary Component', 'salary_component': 'Professional Tax', 'description': 'Professional Tax', 'type': 'Deduction'},
|
||||||
|
{'doctype': 'Salary Component', 'salary_component': 'Provident Fund', 'description': 'Provident fund', 'type': 'Deduction'},
|
||||||
|
{'doctype': 'Salary Component', 'salary_component': 'House Rent Allowance', 'description': 'House Rent Allowance', 'type': 'Earning'},
|
||||||
|
{'doctype': 'Salary Component', 'salary_component': 'Basic', 'description': 'Basic', 'type': 'Earning'},
|
||||||
|
{'doctype': 'Salary Component', 'salary_component': 'Arrear', 'description': 'Arrear', 'type': 'Earning'},
|
||||||
|
{'doctype': 'Salary Component', 'salary_component': 'Leave Encashment', 'description': 'Leave Encashment', 'type': 'Earning'}
|
||||||
|
])
|
||||||
|
|
||||||
|
def set_tax_withholding_category(docs, company):
|
||||||
|
accounts = []
|
||||||
|
tds_account = frappe.db.get_value("Account", filter={"account_type": "Payable",
|
||||||
|
"account_name": "TDS", "company": company})
|
||||||
|
|
||||||
|
if company and tds_account:
|
||||||
|
accounts = [
|
||||||
|
{
|
||||||
|
'company': company,
|
||||||
|
'account': tds_account
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
docs.extend([
|
||||||
|
{
|
||||||
|
'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
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
def set_tds_account(docs, company):
|
||||||
|
docs.extend([
|
||||||
|
{
|
||||||
|
'doctype': 'Account', 'account_name': 'TDS', 'account_type': 'Payable',
|
||||||
|
'parent_account': 'Accounts Payable', 'company': company
|
||||||
|
}
|
||||||
|
])
|
Loading…
x
Reference in New Issue
Block a user