Merge pull request #22257 from rohitwaghchaure/fixed-travis-for-develop-branch
fix: travis for develop
This commit is contained in:
commit
64c0e8f325
@ -6,4 +6,6 @@ import frappe
|
|||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
''' Move from due_advance_amount to pending_amount '''
|
''' Move from due_advance_amount to pending_amount '''
|
||||||
frappe.db.sql(''' UPDATE `tabEmployee Advance` SET pending_amount=due_advance_amount ''')
|
|
||||||
|
if frappe.db.has_column("Employee Advance", "due_advance_amount"):
|
||||||
|
frappe.db.sql(''' UPDATE `tabEmployee Advance` SET pending_amount=due_advance_amount ''')
|
||||||
|
@ -13,7 +13,7 @@ from erpnext.projects.doctype.timesheet.timesheet import make_salary_slip, make_
|
|||||||
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
|
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
|
||||||
from erpnext.hr.doctype.salary_structure.test_salary_structure \
|
from erpnext.hr.doctype.salary_structure.test_salary_structure \
|
||||||
import make_salary_structure, create_salary_structure_assignment
|
import make_salary_structure, create_salary_structure_assignment
|
||||||
|
from erpnext.hr.doctype.employee.test_employee import make_employee
|
||||||
|
|
||||||
class TestTimesheet(unittest.TestCase):
|
class TestTimesheet(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -25,8 +25,10 @@ class TestTimesheet(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
def test_timesheet_billing_amount(self):
|
def test_timesheet_billing_amount(self):
|
||||||
make_salary_structure_for_timesheet("_T-Employee-00001")
|
emp = make_employee("test_employee_6@salary.com")
|
||||||
timesheet = make_timesheet("_T-Employee-00001", simulate=True, billable=1)
|
|
||||||
|
make_salary_structure_for_timesheet(emp)
|
||||||
|
timesheet = make_timesheet(emp, simulate=True, billable=1)
|
||||||
|
|
||||||
self.assertEqual(timesheet.total_hours, 2)
|
self.assertEqual(timesheet.total_hours, 2)
|
||||||
self.assertEqual(timesheet.total_billable_hours, 2)
|
self.assertEqual(timesheet.total_billable_hours, 2)
|
||||||
@ -35,8 +37,10 @@ class TestTimesheet(unittest.TestCase):
|
|||||||
self.assertEqual(timesheet.total_billable_amount, 100)
|
self.assertEqual(timesheet.total_billable_amount, 100)
|
||||||
|
|
||||||
def test_timesheet_billing_amount_not_billable(self):
|
def test_timesheet_billing_amount_not_billable(self):
|
||||||
make_salary_structure_for_timesheet("_T-Employee-00001")
|
emp = make_employee("test_employee_6@salary.com")
|
||||||
timesheet = make_timesheet("_T-Employee-00001", simulate=True, billable=0)
|
|
||||||
|
make_salary_structure_for_timesheet(emp)
|
||||||
|
timesheet = make_timesheet(emp, simulate=True, billable=0)
|
||||||
|
|
||||||
self.assertEqual(timesheet.total_hours, 2)
|
self.assertEqual(timesheet.total_hours, 2)
|
||||||
self.assertEqual(timesheet.total_billable_hours, 0)
|
self.assertEqual(timesheet.total_billable_hours, 0)
|
||||||
@ -45,8 +49,10 @@ class TestTimesheet(unittest.TestCase):
|
|||||||
self.assertEqual(timesheet.total_billable_amount, 0)
|
self.assertEqual(timesheet.total_billable_amount, 0)
|
||||||
|
|
||||||
def test_salary_slip_from_timesheet(self):
|
def test_salary_slip_from_timesheet(self):
|
||||||
salary_structure = make_salary_structure_for_timesheet("_T-Employee-00001")
|
emp = make_employee("test_employee_6@salary.com")
|
||||||
timesheet = make_timesheet("_T-Employee-00001", simulate = True, billable=1)
|
|
||||||
|
salary_structure = make_salary_structure_for_timesheet(emp)
|
||||||
|
timesheet = make_timesheet(emp, simulate = True, billable=1)
|
||||||
salary_slip = make_salary_slip(timesheet.name)
|
salary_slip = make_salary_slip(timesheet.name)
|
||||||
salary_slip.submit()
|
salary_slip.submit()
|
||||||
|
|
||||||
@ -65,7 +71,9 @@ class TestTimesheet(unittest.TestCase):
|
|||||||
self.assertEqual(timesheet.status, 'Submitted')
|
self.assertEqual(timesheet.status, 'Submitted')
|
||||||
|
|
||||||
def test_sales_invoice_from_timesheet(self):
|
def test_sales_invoice_from_timesheet(self):
|
||||||
timesheet = make_timesheet("_T-Employee-00001", simulate=True, billable=1)
|
emp = make_employee("test_employee_6@salary.com")
|
||||||
|
|
||||||
|
timesheet = make_timesheet(emp, simulate=True, billable=1)
|
||||||
sales_invoice = make_sales_invoice(timesheet.name, '_Test Item', '_Test Customer')
|
sales_invoice = make_sales_invoice(timesheet.name, '_Test Item', '_Test Customer')
|
||||||
sales_invoice.due_date = nowdate()
|
sales_invoice.due_date = nowdate()
|
||||||
sales_invoice.submit()
|
sales_invoice.submit()
|
||||||
@ -80,7 +88,9 @@ class TestTimesheet(unittest.TestCase):
|
|||||||
self.assertEqual(item.rate, 50.00)
|
self.assertEqual(item.rate, 50.00)
|
||||||
|
|
||||||
def test_timesheet_billing_based_on_project(self):
|
def test_timesheet_billing_based_on_project(self):
|
||||||
timesheet = make_timesheet("_T-Employee-00001", simulate=True, billable=1, project = '_Test Project', company='_Test Company')
|
emp = make_employee("test_employee_6@salary.com")
|
||||||
|
|
||||||
|
timesheet = make_timesheet(emp, simulate=True, billable=1, project = '_Test Project', company='_Test Company')
|
||||||
sales_invoice = create_sales_invoice(do_not_save=True)
|
sales_invoice = create_sales_invoice(do_not_save=True)
|
||||||
sales_invoice.project = '_Test Project'
|
sales_invoice.project = '_Test Project'
|
||||||
sales_invoice.submit()
|
sales_invoice.submit()
|
||||||
@ -90,6 +100,8 @@ class TestTimesheet(unittest.TestCase):
|
|||||||
self.assertEqual(ts.time_logs[0].sales_invoice, sales_invoice.name)
|
self.assertEqual(ts.time_logs[0].sales_invoice, sales_invoice.name)
|
||||||
|
|
||||||
def test_timesheet_time_overlap(self):
|
def test_timesheet_time_overlap(self):
|
||||||
|
emp = make_employee("test_employee_6@salary.com")
|
||||||
|
|
||||||
settings = frappe.get_single('Projects Settings')
|
settings = frappe.get_single('Projects Settings')
|
||||||
initial_setting = settings.ignore_employee_time_overlap
|
initial_setting = settings.ignore_employee_time_overlap
|
||||||
settings.ignore_employee_time_overlap = 0
|
settings.ignore_employee_time_overlap = 0
|
||||||
@ -97,7 +109,7 @@ class TestTimesheet(unittest.TestCase):
|
|||||||
|
|
||||||
update_activity_type("_Test Activity Type")
|
update_activity_type("_Test Activity Type")
|
||||||
timesheet = frappe.new_doc("Timesheet")
|
timesheet = frappe.new_doc("Timesheet")
|
||||||
timesheet.employee = "_T-Employee-00001"
|
timesheet.employee = emp
|
||||||
timesheet.append(
|
timesheet.append(
|
||||||
'time_logs',
|
'time_logs',
|
||||||
{
|
{
|
||||||
@ -129,12 +141,14 @@ class TestTimesheet(unittest.TestCase):
|
|||||||
settings.save()
|
settings.save()
|
||||||
|
|
||||||
def test_timesheet_std_working_hours(self):
|
def test_timesheet_std_working_hours(self):
|
||||||
|
emp = make_employee("test_employee_6@salary.com")
|
||||||
|
|
||||||
company = frappe.get_doc('Company', "_Test Company")
|
company = frappe.get_doc('Company', "_Test Company")
|
||||||
company.standard_working_hours = 8
|
company.standard_working_hours = 8
|
||||||
company.save()
|
company.save()
|
||||||
|
|
||||||
timesheet = frappe.new_doc("Timesheet")
|
timesheet = frappe.new_doc("Timesheet")
|
||||||
timesheet.employee = "_T-Employee-00001"
|
timesheet.employee = emp
|
||||||
timesheet.company = '_Test Company'
|
timesheet.company = '_Test Company'
|
||||||
timesheet.append(
|
timesheet.append(
|
||||||
'time_logs',
|
'time_logs',
|
||||||
@ -156,7 +170,7 @@ class TestTimesheet(unittest.TestCase):
|
|||||||
company.save()
|
company.save()
|
||||||
|
|
||||||
timesheet = frappe.new_doc("Timesheet")
|
timesheet = frappe.new_doc("Timesheet")
|
||||||
timesheet.employee = "_T-Employee-00001"
|
timesheet.employee = emp
|
||||||
timesheet.company = '_Test Company'
|
timesheet.company = '_Test Company'
|
||||||
timesheet.append(
|
timesheet.append(
|
||||||
'time_logs',
|
'time_logs',
|
||||||
|
@ -5,7 +5,7 @@ from __future__ import unicode_literals
|
|||||||
import frappe
|
import frappe
|
||||||
import unittest
|
import unittest
|
||||||
from erpnext.support.doctype.service_level_agreement.test_service_level_agreement import create_service_level_agreements_for_issues
|
from erpnext.support.doctype.service_level_agreement.test_service_level_agreement import create_service_level_agreements_for_issues
|
||||||
from frappe.utils import now_datetime, get_datetime
|
from frappe.utils import now_datetime, get_datetime, flt
|
||||||
import datetime
|
import datetime
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ class TestIssue(unittest.TestCase):
|
|||||||
create_communication(issue.name, "test@example.com", "Received", creation)
|
create_communication(issue.name, "test@example.com", "Received", creation)
|
||||||
|
|
||||||
issue.reload()
|
issue.reload()
|
||||||
self.assertEqual(issue.total_hold_time, 2700)
|
self.assertEqual(flt(issue.total_hold_time, 2), 2700)
|
||||||
self.assertEqual(issue.resolution_by, datetime.datetime(2020, 3, 4, 16, 45))
|
self.assertEqual(issue.resolution_by, datetime.datetime(2020, 3, 4, 16, 45))
|
||||||
|
|
||||||
creation = datetime.datetime(2020, 3, 4, 5, 5)
|
creation = datetime.datetime(2020, 3, 4, 5, 5)
|
||||||
@ -132,7 +132,7 @@ class TestIssue(unittest.TestCase):
|
|||||||
issue.save()
|
issue.save()
|
||||||
|
|
||||||
issue.reload()
|
issue.reload()
|
||||||
self.assertEqual(issue.total_hold_time, 2700)
|
self.assertEqual(flt(issue.total_hold_time, 2), 2700)
|
||||||
|
|
||||||
|
|
||||||
def make_issue(creation=None, customer=None, index=0):
|
def make_issue(creation=None, customer=None, index=0):
|
||||||
|
Loading…
Reference in New Issue
Block a user