Merge pull request #1616 from pdvyas/migrate-3to4
3 to 4 migration fixes
This commit is contained in:
commit
75e11a7270
@ -155,6 +155,8 @@ class Employee(Document):
|
|||||||
throw(_("Please enter relieving date."))
|
throw(_("Please enter relieving date."))
|
||||||
|
|
||||||
def validate_for_enabled_user_id(self):
|
def validate_for_enabled_user_id(self):
|
||||||
|
if not self.status == 'Active':
|
||||||
|
return
|
||||||
enabled = frappe.db.sql("""select name from `tabUser` where
|
enabled = frappe.db.sql("""select name from `tabUser` where
|
||||||
name=%s and enabled=1""", self.user_id)
|
name=%s and enabled=1""", self.user_id)
|
||||||
if not enabled:
|
if not enabled:
|
||||||
|
@ -23,10 +23,10 @@ def execute():
|
|||||||
"item_group": item_group,
|
"item_group": item_group,
|
||||||
"applicable_for": "Customer",
|
"applicable_for": "Customer",
|
||||||
"customer": d.parent,
|
"customer": d.parent,
|
||||||
"price_or_discount": "Discount",
|
"price_or_discount": "Discount Percentage",
|
||||||
"discount_percentage": d.discount
|
"discount_percentage": d.discount
|
||||||
}).insert()
|
}).insert()
|
||||||
|
|
||||||
frappe.db.auto_commit_on_many_writes = False
|
frappe.db.auto_commit_on_many_writes = False
|
||||||
|
|
||||||
frappe.delete_doc("DocType", "Customer Discount")
|
frappe.delete_doc("DocType", "Customer Discount")
|
||||||
|
@ -8,6 +8,7 @@ import frappe.defaults
|
|||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
frappe.reload_doc("core", "doctype", "docperm")
|
frappe.reload_doc("core", "doctype", "docperm")
|
||||||
|
frappe.reload_doc("hr", "doctype", "employee")
|
||||||
update_user_properties()
|
update_user_properties()
|
||||||
update_user_match()
|
update_user_match()
|
||||||
add_employee_restrictions_to_leave_approver()
|
add_employee_restrictions_to_leave_approver()
|
||||||
@ -82,13 +83,11 @@ def add_employee_restrictions_to_leave_approver():
|
|||||||
|
|
||||||
# add Employee restrictions (in on_update method)
|
# add Employee restrictions (in on_update method)
|
||||||
for employee in frappe.db.sql_list("""select name from `tabEmployee`
|
for employee in frappe.db.sql_list("""select name from `tabEmployee`
|
||||||
where exists(select leave_approver from `tabEmployee Leave Approver`
|
where (exists(select leave_approver from `tabEmployee Leave Approver`
|
||||||
where `tabEmployee Leave Approver`.parent=`tabEmployee`.name)
|
where `tabEmployee Leave Approver`.parent=`tabEmployee`.name)
|
||||||
or ifnull(`reports_to`, '')!=''"""):
|
or ifnull(`reports_to`, '')!='') and docstatus<2 and status='Active'"""):
|
||||||
|
|
||||||
emp = frappe.get_doc("Employee", employee)
|
frappe.get_doc("Employee", employee).save()
|
||||||
emp.ignore_links = True
|
|
||||||
emp.save()
|
|
||||||
|
|
||||||
def update_permissions():
|
def update_permissions():
|
||||||
# clear match conditions other than owner
|
# clear match conditions other than owner
|
||||||
|
@ -17,7 +17,7 @@ class SupportEmailSettings(Document):
|
|||||||
Checks support ticket email settings
|
Checks support ticket email settings
|
||||||
"""
|
"""
|
||||||
if self.sync_support_mails and self.mail_server:
|
if self.sync_support_mails and self.mail_server:
|
||||||
inc_email = frappe.get_doc('Incoming Email Settings')
|
inc_email = frappe._dict(self.as_dict())
|
||||||
# inc_email.encode()
|
# inc_email.encode()
|
||||||
inc_email.host = self.mail_server
|
inc_email.host = self.mail_server
|
||||||
inc_email.use_ssl = self.use_ssl
|
inc_email.use_ssl = self.use_ssl
|
||||||
|
Loading…
Reference in New Issue
Block a user