Duct tape for demo (#14241)

The demo is just too old and needs a complete refactor. This is just a
workaroud to keep the demo working
This commit is contained in:
Ameya Shenoy
2018-05-27 12:45:32 +05:30
committed by Rushabh Mehta
parent 64d02f917a
commit 67c9566e77

View File

@@ -21,10 +21,10 @@ def setup(domain):
employees = frappe.get_all('Employee', fields=['name', 'date_of_joining']) employees = frappe.get_all('Employee', fields=['name', 'date_of_joining'])
# monthly salary # monthly salary
setup_salary_structure(employees[:5], 0) #setup_salary_structure(employees[:5], 0)
# based on timesheet # based on timesheet
setup_salary_structure(employees[5:], 1) #setup_salary_structure(employees[5:], 1)
setup_leave_allocation() setup_leave_allocation()
setup_customer() setup_customer()
@@ -140,14 +140,14 @@ def setup_employee():
def setup_salary_structure(employees, salary_slip_based_on_timesheet=0): def setup_salary_structure(employees, salary_slip_based_on_timesheet=0):
f = frappe.get_doc('Fiscal Year', frappe.defaults.get_global_default('fiscal_year')) f = frappe.get_doc('Fiscal Year', frappe.defaults.get_global_default('fiscal_year'))
ss = frappe.new_doc('Salary Structure') #ss = frappe.new_doc('Salary Structure')
ss.name = "Sample Salary Structure - " + random_string(5) #ss.name = "Sample Salary Structure - " + random_string(5)
for e in employees: #for e in employees:
ss.append('employees', { # ss.append('employees', {
'employee': e.name, # 'employee': e.name,
'from_date': "2015-01-01", # 'from_date': "2015-01-01",
'base': random.random() * 10000 # 'base': random.random() * 10000
}) # })
ss.from_date = e.date_of_joining if (e.date_of_joining ss.from_date = e.date_of_joining if (e.date_of_joining
and e.date_of_joining > f.year_start_date) else f.year_start_date and e.date_of_joining > f.year_start_date) else f.year_start_date