Ejemplo n.º 1
0
def make_timesheet_for_projects(current_date):
    for data in frappe.get_all("Task", ["name", "project"], {
            "status": "Open",
            "exp_end_date": ("<", current_date)
    }):
        employee = get_random("Employee")
        if frappe.db.get_value('Salary Structure', {'employee': employee},
                               'salary_slip_based_on_timesheet'):
            make_timesheet(employee,
                           simulate=True,
                           billable=1,
                           activity_type=get_random("Activity Type"),
                           project=data.project,
                           task=data.name)
    def setUp(self):
        frappe.db.sql("delete from `tabTimesheet`")
        emp = make_employee("*****@*****.**",
                            company="_Test Company")

        if not frappe.db.exists("Salary Component", "Timesheet Component"):
            frappe.get_doc({
                "doctype": "Salary Component",
                "salary_component": "Timesheet Component"
            }).insert()

        make_salary_structure_for_timesheet(emp, company="_Test Company")
        date = getdate()

        self.timesheet = make_timesheet(emp, is_billable=1)
        self.salary_slip = make_salary_slip(self.timesheet.name)
        self.salary_slip.start_date = self.timesheet.start_date

        holidays = self.salary_slip.get_holidays_for_employee(date, date)
        if holidays:
            frappe.db.set_value("Payroll Settings", None,
                                "include_holidays_in_total_working_days", 1)

        self.salary_slip.submit()
        self.sales_invoice = make_sales_invoice(self.timesheet.name,
                                                "_Test Item", "_Test Customer")
        self.sales_invoice.due_date = date
        self.sales_invoice.submit()

        frappe.db.set_value("HR Settings", None, "standard_working_hours", 8)
        frappe.db.set_value("Payroll Settings", None,
                            "include_holidays_in_total_working_days", 0)
Ejemplo n.º 3
0
    def setUp(self):
        emp = make_employee('*****@*****.**',
                            company='_Test Company')
        if not frappe.db.exists('Salary Component', 'Timesheet Component'):
            frappe.get_doc({
                'doctype': 'Salary Component',
                'salary_component': 'Timesheet Component'
            }).insert()
        make_salary_structure_for_timesheet(emp, company='_Test Company')
        self.timesheet = make_timesheet(emp, simulate=True, is_billable=1)
        self.salary_slip = make_salary_slip(self.timesheet.name)
        holidays = self.salary_slip.get_holidays_for_employee(
            nowdate(), nowdate())
        if holidays:
            frappe.db.set_value('Payroll Settings', None,
                                'include_holidays_in_total_working_days', 1)

        self.salary_slip.submit()
        self.sales_invoice = make_sales_invoice(self.timesheet.name,
                                                '_Test Item', '_Test Customer')
        self.sales_invoice.due_date = nowdate()
        self.sales_invoice.submit()

        frappe.db.set_value('HR Settings', None, 'standard_working_hours', 8)
        frappe.db.set_value('Payroll Settings', None,
                            'include_holidays_in_total_working_days', 0)
Ejemplo n.º 4
0
def make_timesheet_for_projects(current_date	):
	for data in frappe.get_all("Task", ["name", "project"], {"status": "Open", "exp_end_date": ("<", current_date)}):
		employee = get_random("Employee")
		ts = make_timesheet(employee, simulate = True, billable = 1, company = erpnext.get_default_company(),
			activity_type=get_random("Activity Type"), project=data.project, task =data.name)

		if flt(ts.total_billable_amount) > 0.0:
			make_sales_invoice_for_timesheet(ts.name)
			frappe.db.commit()
Ejemplo n.º 5
0
def make_timesheet_for_projects(current_date	):
	for data in frappe.get_all("Task", ["name", "project"], {"status": "Open", "exp_end_date": ("<", current_date)}):
		employee = get_random("Employee")
		ts = make_timesheet(employee, simulate = True, billable = 1, company = erpnext.get_default_company(),
			activity_type=get_random("Activity Type"), project=data.project, task =data.name)

		if flt(ts.total_billable_amount) > 0.0:
			make_sales_invoice_for_timesheet(ts.name)
			frappe.db.commit()
Ejemplo n.º 6
0
def make_timesheet_for_projects(current_date	):
	for data in frappe.get_all("Task", ["name", "project"], {"status": "Open", "exp_end_date": ("<", current_date)}):
		employee = get_random("Employee")
		if frappe.db.get_value('Salary Structure', {'employee': employee}, 'salary_slip_based_on_timesheet'):
			ts = make_timesheet(employee, simulate = True, billable = 1,
				activity_type=get_random("Activity Type"), project=data.project, task =data.name)

			if flt(ts.total_billing_amount) > 0.0:
				make_sales_invoice_for_timesheet(ts.name)
				frappe.db.commit()
Ejemplo n.º 7
0
def make_timesheet_records():
	employees = get_timesheet_based_salary_slip_employee()
	for e in employees:
		ts = make_timesheet(e.employee, simulate = True, billable = 1, activity_type=get_random("Activity Type"))

		rand = random.random()
		if rand >= 0.3:
			make_salary_slip_for_timesheet(ts.name)

		rand = random.random()
		if rand >= 0.2:
			make_sales_invoice_for_timesheet(ts.name)
Ejemplo n.º 8
0
    def setUp(self):
        emp = make_employee('*****@*****.**',
                            company='_Test Company')
        if not frappe.db.exists('Salary Component', 'Timesheet Component'):
            frappe.get_doc({
                'doctype': 'Salary Component',
                'salary_component': 'Timesheet Component'
            }).insert()
        make_salary_structure_for_timesheet(emp, company='_Test Company')
        self.timesheet = make_timesheet(emp, simulate=True, billable=1)
        self.salary_slip = make_salary_slip(self.timesheet.name)
        self.salary_slip.submit()
        self.sales_invoice = make_sales_invoice(self.timesheet.name,
                                                '_Test Item', '_Test Customer')
        self.sales_invoice.due_date = nowdate()
        self.sales_invoice.submit()

        frappe.db.set_value("HR Settings", "HR Settings",
                            "standard_working_hours", 8)