Merge pull request #6144 from nabinhait/timesheet_patch_fix

Ignore validating mandatory fields on converting timelogs to timesheets
This commit is contained in:
Nabin Hait 2016-08-22 14:39:01 +05:30 committed by GitHub
commit 43accf4c07
2 changed files with 12 additions and 3 deletions

View File

@ -16,7 +16,6 @@ def execute():
time_sheet = make_timesheet(data.production_order)
args = get_timelog_data(data)
add_timesheet_detail(time_sheet, args)
time_sheet.docstatus = data.docstatus
time_sheet.note = data.note
time_sheet.company = company
@ -25,6 +24,15 @@ def execute():
time_sheet.calculate_total_amounts()
time_sheet.flags.ignore_validate = True
time_sheet.save(ignore_permissions=True)
# To ignore validate_mandatory_fields function
if data.docstatus == 1:
time_sheet.db_set("docstatus", 1)
for d in time_sheet.get("time_logs"):
d.db_set("docstatus", 1)
time_sheet.update_production_order(time_sheet.name)
time_sheet.update_task_and_project()
def get_timelog_data(data):
return {

View File

@ -9,12 +9,13 @@ def execute():
frappe.reload_doc('website', 'doctype', 'portal_menu_item')
frappe.reload_doc('buying', 'doctype', 'request_for_quotation')
if 'schools' in frappe.get_installed_apps():
if frappe.db.exists("Module Def", "Academics") \
and frappe.db.get_value("Module Def", "Academics", "app_name") == "schools":
frappe.db.sql("""delete from `tabDesktop Icon`""")
if not frappe.db.exists('Module Def', 'Schools') and frappe.db.exists('Module Def', 'Academics'):
frappe.rename_doc("Module Def", "Academics", "Schools")
remove_from_installed_apps("schools")
def reload_doctypes_for_schools_icons():