Patch fixes

This commit is contained in:
Nabin Hait 2018-07-03 13:06:31 +05:30
parent f4660d2479
commit 9911309631
3 changed files with 14 additions and 5 deletions

View File

@ -33,7 +33,7 @@ class PayrollEntry(Document):
if self.payroll_frequency:
condition = """and payroll_frequency = '%(payroll_frequency)s'"""% {"payroll_frequency": self.payroll_frequency}
sal_struct = frappe.db.sql("""
sal_struct = frappe.db.sql_list("""
select
name from `tabSalary Structure`
where
@ -54,7 +54,8 @@ class PayrollEntry(Document):
where
t1.name = t2.employee
and t2.docstatus = 1
%s order by t2.from_date desc"""% cond, {"sal_struct": sal_struct, "from_date": self.start_date}, as_dict=True)
%s order by t2.from_date desc
""" % cond, {"sal_struct": tuple(sal_struct), "from_date": self.start_date}, as_dict=True)
return emp_list
def fill_employee_details(self):

View File

@ -8,9 +8,15 @@ from erpnext.hr.doctype.salary_structure_assignment.salary_structure_assignment
def execute():
frappe.reload_doc("hr", "doctype", "salary_structure_assignment")
frappe.db.sql("""
delete from `tabSalary Structure Assignment`
where salary_structure in (select name from `tabSalary Structure` where is_active='No' or docstatus!=1)
""")
for d in frappe.db.sql("""
select sse.*, ss.company from `tabSalary Structure Employee` sse, `tabSalary Structure` ss
where ss.name = sse.parent AND sse.employee in (select name from `tabEmployee` where ifNull(status, '') != 'Left')""", as_dict=1):
select sse.*, ss.company
from `tabSalary Structure Employee` sse, `tabSalary Structure` ss
where ss.name = sse.parent AND ss.is_active='Yes'
AND sse.employee in (select name from `tabEmployee` where ifNull(status, '') != 'Left')""", as_dict=1):
try:
s = frappe.new_doc("Salary Structure Assignment")
s.employee = d.employee

View File

@ -11,10 +11,12 @@ def execute():
[ default_warehouse, buying_cost_center, expense_account, selling_cost_center, income_account ]
'''
if not frappe.db.has_column('Item', 'default_warehouse'):
return
frappe.reload_doc('stock', 'doctype', 'item_default')
frappe.reload_doc('stock', 'doctype', 'item')
companies = frappe.get_all("Company")
if len(companies) == 1:
frappe.db.sql('''