Merge branch 'staging-fixes' into fixed_salary_structure_employee_reqd

This commit is contained in:
Sagar Vora 2019-01-07 14:30:23 +05:30 committed by GitHub
commit 26e5c9480b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 36 additions and 10 deletions

View File

@ -213,7 +213,7 @@ def prepare_data(accounts, balance_must_be, period_list, company_currency):
total = 0
row = frappe._dict({
"account": _(d.name),
"parent_account": _(d.parent_account),
"parent_account": _(d.parent_account) if d.parent_account else '',
"indent": flt(d.indent),
"year_start_date": year_start_date,
"year_end_date": year_end_date,

View File

@ -25,7 +25,7 @@ def execute(filters=None):
account_details.setdefault(acc.name, acc)
if filters.get('party'):
parties = str(filters.get("party")).strip()
parties = cstr(filters.get("party")).strip()
filters.party = [d.strip() for d in parties.split(',') if d]
validate_filters(filters, account_details)
@ -60,11 +60,11 @@ def validate_filters(filters, account_details):
frappe.throw(_("From Date must be before To Date"))
if filters.get('project'):
projects = str(filters.get("project")).strip()
projects = cstr(filters.get("project")).strip()
filters.project = [d.strip() for d in projects.split(',') if d]
if filters.get('cost_center'):
cost_centers = str(filters.get("cost_center")).strip()
cost_centers = cstr(filters.get("cost_center")).strip()
filters.cost_center = [d.strip() for d in cost_centers.split(',') if d]

View File

@ -12,7 +12,7 @@ app_license = "GNU General Public License (v3)"
source_link = "https://github.com/frappe/erpnext"
develop_version = '12.x.x-develop'
staging_version = '11.0.3-beta.32'
staging_version = '11.0.3-beta.33'
error_report_email = "support@erpnext.com"

View File

@ -1,9 +1,24 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import unittest
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')

View File

@ -457,7 +457,7 @@ def get_leave_period():
return frappe.get_doc(dict(
name = 'Test 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),
company = "_Test Company",
is_active = 1

View File

@ -29,6 +29,5 @@ class TestUploadAttendance(unittest.TestCase):
for row in data:
if row[1] == employee:
filtered_data.append(row)
print(filtered_data)
for row in filtered_data:
self.assertTrue(getdate(row[3]) >= getdate(date_of_joining) and getdate(row[3]) <= getdate(relieving_date))

View File

@ -186,6 +186,8 @@ def make_salary_structure_for_timesheet(employee):
if not frappe.db.get_value("Salary Structure Assignment",
{'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)
return salary_structure

View File

@ -146,8 +146,18 @@ class TransactionBase(StatusUpdater):
return ret
def delete_events(ref_type, ref_name):
frappe.delete_doc("Event", frappe.db.sql_list("""select name from `tabEvent`
where ref_type=%s and ref_name=%s""", (ref_type, ref_name)), for_reload=True)
events = frappe.db.sql_list(""" SELECT
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):
if isinstance(qty_fields, string_types):