mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-08 15:42:52 +00:00
Merge branch 'staging-fixes' into update_items_bug
This commit is contained in:
@@ -1,9 +1,24 @@
|
|||||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
# License: GNU General Public License v3. See license.txt
|
# License: GNU General Public License v3. See license.txt
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
import unittest
|
||||||
|
|
||||||
test_ignore = ["Leave Block List"]
|
test_ignore = ["Leave Block List"]
|
||||||
|
class TestDepartment(unittest.TestCase):
|
||||||
|
def test_remove_department_data(self):
|
||||||
|
doc = create_department("Test Department")
|
||||||
|
frappe.delete_doc('Department', doc.name)
|
||||||
|
|
||||||
|
def create_department(department_name, parent_department=None):
|
||||||
|
doc = frappe.get_doc({
|
||||||
|
'doctype': 'Department',
|
||||||
|
'is_group': 0,
|
||||||
|
'parent_department': parent_department,
|
||||||
|
'department_name': department_name,
|
||||||
|
'company': frappe.defaults.get_defaults().company
|
||||||
|
}).insert()
|
||||||
|
|
||||||
|
return doc
|
||||||
|
|
||||||
import frappe
|
|
||||||
test_records = frappe.get_test_records('Department')
|
test_records = frappe.get_test_records('Department')
|
||||||
@@ -457,7 +457,7 @@ def get_leave_period():
|
|||||||
return frappe.get_doc(dict(
|
return frappe.get_doc(dict(
|
||||||
name = 'Test Leave Period',
|
name = 'Test Leave Period',
|
||||||
doctype = 'Leave Period',
|
doctype = 'Leave Period',
|
||||||
from_date = "{0}-01-01".format(now_datetime().year),
|
from_date = "{0}-12-01".format(now_datetime().year - 1),
|
||||||
to_date = "{0}-12-31".format(now_datetime().year),
|
to_date = "{0}-12-31".format(now_datetime().year),
|
||||||
company = "_Test Company",
|
company = "_Test Company",
|
||||||
is_active = 1
|
is_active = 1
|
||||||
|
|||||||
@@ -29,6 +29,5 @@ class TestUploadAttendance(unittest.TestCase):
|
|||||||
for row in data:
|
for row in data:
|
||||||
if row[1] == employee:
|
if row[1] == employee:
|
||||||
filtered_data.append(row)
|
filtered_data.append(row)
|
||||||
print(filtered_data)
|
|
||||||
for row in filtered_data:
|
for row in filtered_data:
|
||||||
self.assertTrue(getdate(row[3]) >= getdate(date_of_joining) and getdate(row[3]) <= getdate(relieving_date))
|
self.assertTrue(getdate(row[3]) >= getdate(date_of_joining) and getdate(row[3]) <= getdate(relieving_date))
|
||||||
|
|||||||
@@ -186,6 +186,8 @@ def make_salary_structure_for_timesheet(employee):
|
|||||||
|
|
||||||
if not frappe.db.get_value("Salary Structure Assignment",
|
if not frappe.db.get_value("Salary Structure Assignment",
|
||||||
{'employee':employee, 'docstatus': 1}):
|
{'employee':employee, 'docstatus': 1}):
|
||||||
|
frappe.db.set_value('Employee', employee, 'date_of_joining',
|
||||||
|
add_months(nowdate(), -5))
|
||||||
create_salary_structure_assignment(employee, salary_structure.name)
|
create_salary_structure_assignment(employee, salary_structure.name)
|
||||||
|
|
||||||
return salary_structure
|
return salary_structure
|
||||||
|
|||||||
@@ -146,8 +146,18 @@ class TransactionBase(StatusUpdater):
|
|||||||
return ret
|
return ret
|
||||||
|
|
||||||
def delete_events(ref_type, ref_name):
|
def delete_events(ref_type, ref_name):
|
||||||
frappe.delete_doc("Event", frappe.db.sql_list("""select name from `tabEvent`
|
events = frappe.db.sql_list(""" SELECT
|
||||||
where ref_type=%s and ref_name=%s""", (ref_type, ref_name)), for_reload=True)
|
distinct `tabEvent`.name
|
||||||
|
from
|
||||||
|
`tabEvent`, `tabEvent Participants`
|
||||||
|
where
|
||||||
|
`tabEvent`.name = `tabEvent Participants`.parent
|
||||||
|
and `tabEvent Participants`.reference_doctype = %s
|
||||||
|
and `tabEvent Participants`.reference_docname = %s
|
||||||
|
""", (ref_type, ref_name)) or []
|
||||||
|
|
||||||
|
if events:
|
||||||
|
frappe.delete_doc("Event", events, for_reload=True)
|
||||||
|
|
||||||
def validate_uom_is_integer(doc, uom_field, qty_fields, child_dt=None):
|
def validate_uom_is_integer(doc, uom_field, qty_fields, child_dt=None):
|
||||||
if isinstance(qty_fields, string_types):
|
if isinstance(qty_fields, string_types):
|
||||||
|
|||||||
Reference in New Issue
Block a user