fix: travis for develop
diff --git a/erpnext/patches/v12_0/move_due_advance_amount_to_pending_amount.py b/erpnext/patches/v12_0/move_due_advance_amount_to_pending_amount.py
index f1ffaf9..6013eaa 100644
--- a/erpnext/patches/v12_0/move_due_advance_amount_to_pending_amount.py
+++ b/erpnext/patches/v12_0/move_due_advance_amount_to_pending_amount.py
@@ -6,4 +6,6 @@
def execute():
''' 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 ''')
diff --git a/erpnext/projects/doctype/timesheet/test_timesheet.py b/erpnext/projects/doctype/timesheet/test_timesheet.py
index 32f0428..cbc624c 100644
--- a/erpnext/projects/doctype/timesheet/test_timesheet.py
+++ b/erpnext/projects/doctype/timesheet/test_timesheet.py
@@ -13,7 +13,7 @@
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
from erpnext.hr.doctype.salary_structure.test_salary_structure \
import make_salary_structure, create_salary_structure_assignment
-
+from erpnext.hr.doctype.employee.test_employee import make_employee
class TestTimesheet(unittest.TestCase):
def setUp(self):
@@ -25,8 +25,10 @@
def test_timesheet_billing_amount(self):
- make_salary_structure_for_timesheet("_T-Employee-00001")
- timesheet = make_timesheet("_T-Employee-00001", simulate=True, billable=1)
+ emp = make_employee("test_employee_6@salary.com")
+
+ make_salary_structure_for_timesheet(emp)
+ timesheet = make_timesheet(emp, simulate=True, billable=1)
self.assertEqual(timesheet.total_hours, 2)
self.assertEqual(timesheet.total_billable_hours, 2)
@@ -35,8 +37,10 @@
self.assertEqual(timesheet.total_billable_amount, 100)
def test_timesheet_billing_amount_not_billable(self):
- make_salary_structure_for_timesheet("_T-Employee-00001")
- timesheet = make_timesheet("_T-Employee-00001", simulate=True, billable=0)
+ emp = make_employee("test_employee_6@salary.com")
+
+ make_salary_structure_for_timesheet(emp)
+ timesheet = make_timesheet(emp, simulate=True, billable=0)
self.assertEqual(timesheet.total_hours, 2)
self.assertEqual(timesheet.total_billable_hours, 0)
@@ -45,8 +49,10 @@
self.assertEqual(timesheet.total_billable_amount, 0)
def test_salary_slip_from_timesheet(self):
- salary_structure = make_salary_structure_for_timesheet("_T-Employee-00001")
- timesheet = make_timesheet("_T-Employee-00001", simulate = True, billable=1)
+ emp = make_employee("test_employee_6@salary.com")
+
+ 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.submit()
@@ -65,7 +71,9 @@
self.assertEqual(timesheet.status, 'Submitted')
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.due_date = nowdate()
sales_invoice.submit()
@@ -80,7 +88,9 @@
self.assertEqual(item.rate, 50.00)
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.project = '_Test Project'
sales_invoice.submit()
@@ -90,6 +100,8 @@
self.assertEqual(ts.time_logs[0].sales_invoice, sales_invoice.name)
def test_timesheet_time_overlap(self):
+ emp = make_employee("test_employee_6@salary.com")
+
settings = frappe.get_single('Projects Settings')
initial_setting = settings.ignore_employee_time_overlap
settings.ignore_employee_time_overlap = 0
@@ -97,7 +109,7 @@
update_activity_type("_Test Activity Type")
timesheet = frappe.new_doc("Timesheet")
- timesheet.employee = "_T-Employee-00001"
+ timesheet.employee = emp
timesheet.append(
'time_logs',
{
@@ -129,12 +141,14 @@
settings.save()
def test_timesheet_std_working_hours(self):
+ emp = make_employee("test_employee_6@salary.com")
+
company = frappe.get_doc('Company', "_Test Company")
company.standard_working_hours = 8
company.save()
timesheet = frappe.new_doc("Timesheet")
- timesheet.employee = "_T-Employee-00001"
+ timesheet.employee = emp
timesheet.company = '_Test Company'
timesheet.append(
'time_logs',
@@ -156,7 +170,7 @@
company.save()
timesheet = frappe.new_doc("Timesheet")
- timesheet.employee = "_T-Employee-00001"
+ timesheet.employee = emp
timesheet.company = '_Test Company'
timesheet.append(
'time_logs',
diff --git a/erpnext/support/doctype/issue/test_issue.py b/erpnext/support/doctype/issue/test_issue.py
index a004843..fb8ceb5 100644
--- a/erpnext/support/doctype/issue/test_issue.py
+++ b/erpnext/support/doctype/issue/test_issue.py
@@ -5,7 +5,7 @@
import frappe
import unittest
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
from datetime import timedelta
@@ -120,7 +120,7 @@
create_communication(issue.name, "test@example.com", "Received", creation)
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))
creation = datetime.datetime(2020, 3, 4, 5, 5)
@@ -132,7 +132,7 @@
issue.save()
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):