From 1c1e2e9cbed827d46fe577b63611762de7989465 Mon Sep 17 00:00:00 2001 From: Kanchan Chauhan Date: Thu, 20 Oct 2016 14:53:10 +0530 Subject: [PATCH] Demo fixed for Process Payroll and Salary Structure --- erpnext/demo/setup/setup_data.py | 2 +- erpnext/demo/user/hr.py | 20 ++++++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/erpnext/demo/setup/setup_data.py b/erpnext/demo/setup/setup_data.py index d279a64b88..f25bbc337a 100644 --- a/erpnext/demo/setup/setup_data.py +++ b/erpnext/demo/setup/setup_data.py @@ -130,7 +130,7 @@ def setup_salary_structure(): 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 ss.to_date = f.year_end_date - + ss.payment_account = frappe.get_value('Account', {'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name") ss.append('earnings', { 'salary_component': 'Basic', "abbr":'B', diff --git a/erpnext/demo/user/hr.py b/erpnext/demo/user/hr.py index 2b80afbabb..2686987473 100644 --- a/erpnext/demo/user/hr.py +++ b/erpnext/demo/user/hr.py @@ -1,5 +1,5 @@ from __future__ import unicode_literals -import frappe +import frappe, erpnext import random from frappe.utils import random_string, add_days, cint from erpnext.projects.doctype.timesheet.test_timesheet import make_timesheet @@ -24,18 +24,14 @@ def work(): process_payroll.company = frappe.flags.company process_payroll.month = prev_month process_payroll.fiscal_year = year - process_payroll.create_sal_slip() + process_payroll.from_date = frappe.flags.current_date + process_payroll.to_date = add_days(frappe.flags.current_date, random.randint(0, 30)) + process_payroll.reference_number = "DemoRef23" + process_payroll.reference_date = frappe.flags.current_date + process_payroll.payment_account = frappe.get_value('Account', {'account_type': 'Cash', 'company': erpnext.get_default_company(),'is_group':0}, "name") process_payroll.submit_salary_slip() - r = process_payroll.make_journal_entry(frappe.get_value('Account', - {'account_name': 'Salary'})) - - journal_entry = frappe.get_doc(r) - journal_entry.cheque_no = random_string(10) - journal_entry.cheque_date = frappe.flags.current_date - journal_entry.posting_date = frappe.flags.current_date - journal_entry.insert() - journal_entry.submit() - + process_payroll.make_journal_entry() + if frappe.db.get_global('demo_hr_user'): make_timesheet_records()