Skip to content

Commit

Permalink
test: fix net 14 days
Browse files Browse the repository at this point in the history
  • Loading branch information
agritheory committed Feb 28, 2023
1 parent a1e3114 commit 3acea48
Showing 1 changed file with 107 additions and 12 deletions.
119 changes: 107 additions & 12 deletions check_run/test_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def before_test():
create_test_data()
for modu in frappe.get_all('Module Onboarding'):
frappe.db.set_value('Module Onboarding', modu, 'is_complete', 1)
frappe.set_value('Website Settings', 'Website Settings', 'home_page', 'login')
frappe.db.commit()

suppliers = [
Expand Down Expand Up @@ -96,6 +97,104 @@ def before_test():
}),
]

employees = [('Wilmer Larson',
'Male',
'1977-03-06',
'2019-04-12',
'20 Gaven Path',
'Spokane',
'NV',
'66308'),
('Shanel Finley',
'Female',
'1984-04-23',
'2019-07-04',
'1070 Ulloa Green',
'DeKalb',
'PA',
'30474'),
('Camellia Phelps',
'Female',
'1980-07-06',
'2019-07-28',
'787 Sotelo Arcade',
'Stockton',
'CO',
'14860'),
('Michale Mitchell',
'Male',
'1984-06-29',
'2020-01-12',
'773 Icehouse Road',
'West Sacramento',
'VT',
'24355'),
('Sharilyn Romero',
'Female',
'1998-04-22',
'2020-03-20',
'432 Dudley Ranch',
'Clovis',
'WA',
'97159'),
('Doug Buckley',
'Male',
'1979-06-18',
'2020-09-08',
'771 Battery Caulfield Motorway',
'Yonkers',
'VT',
'38125'),
('Margarito Wallace',
'Male',
'1991-08-17',
'2020-11-01',
'639 Brook Park',
'Terre Haute',
'OR',
'41704'),
('Mckenzie Ashley',
'Female',
'1997-09-13',
'2021-02-22',
'1119 Hunter Glen',
'Ormond Beach',
'MD',
'30864'),
('Merrie Oliver',
'Other',
'1979-11-08',
'2021-03-11',
'267 Vega Freeway',
'West Palm Beach',
'FL',
'24411'),
('Naoma Blake',
'Female',
'1987-07-10',
'2021-06-21',
'649 Conrad Road',
'Thousand Oaks',
'CT',
'97929'),
('Donnell Fry',
'Male',
'1994-07-27',
'2021-06-24',
'504 Starr King Canyon',
'Norwalk',
'OR',
'46845'),
('Shalanda Peterson',
'Female',
'1999-10-04',
'2021-08-01',
'109 Seventh Parkway',
'Urbana',
'DE',
'55975')]


def create_test_data():
settings = frappe._dict({
'day': datetime.date(int(frappe.defaults.get_defaults().get('fiscal_year')), 1 ,1),
Expand Down Expand Up @@ -192,7 +291,7 @@ def create_payment_terms_templates(settings):
"payment_term": "Net 14",
"invoice_portion": 100,
"due_date_based_on": "Day(s) after invoice date",
"credit_days": 0})
"credit_days": 14})
doc.save()

def create_suppliers(settings):
Expand Down Expand Up @@ -387,27 +486,25 @@ def config_expense_claim(settings):
pta.parent_account = frappe.get_value('Account', {'account_name': 'Indirect Expenses', 'company': settings.company})
pta.save()


def create_employees(settings):
for employee_number in range(1, 13):
for employee_number, employee in enumerate(employees, start=10):
emp = frappe.new_doc('Employee')
emp.first_name = "Test"
emp.last_name = f"Employee {employee_number}"
emp.first_name = employee[0].split(' ')[0]
emp.last_name = employee[0].split(' ')[1]
emp.employment_type = "Full-time"
emp.company = settings.company
emp.status = "Active"
emp.gender = "Other"
emp.date_of_birth = datetime.date(1990, 1, 1)
emp.date_of_joining = datetime.date(2020, 1, 1)
emp.gender = employee[1]
emp.date_of_birth = employee[2]
emp.date_of_joining = employee[3]
emp.mode_of_payment = 'Check' if employee_number % 3 == 0 else 'ACH/EFT'
emp.mode_of_payment = 'Cash' if employee_number == 10 else emp.mode_of_payment
emp.expense_approver = 'Administrator'
if emp.mode_of_payment == 'ACH/EFT':
emp.bank = 'Local Bank'
emp.bank_account = f'{employee_number}123456'
emp.bank_account = f'{employee_number}12345'
emp.save()


def create_expense_claim(settings):
cost_center = frappe.get_value('Company', settings.company, 'cost_center')
payable_acct = frappe.get_value('Company', settings.company, 'default_payable_account')
Expand Down Expand Up @@ -465,7 +562,6 @@ def create_expense_claim(settings):
ec.save()
ec.submit()


def create_payroll_journal_entry(settings):
emps = frappe.get_list('Employee', {'company': settings.company})
cost_center = frappe.get_value('Company', settings.company, 'cost_center')
Expand Down Expand Up @@ -528,4 +624,3 @@ def create_payroll_journal_entry(settings):
})
je.save()
je.submit()

0 comments on commit 3acea48

Please sign in to comment.