if doc.status == ‘Approved’:
# Update the contract_end_date in the Employee doctype
frappe.db.set_value(‘Employee’, doc.employee, ‘contract_end_date’, doc.contract_end)
frappe.msgprint(‘The Contract End Date in the Employee record has been updated successfully.’)
This is the server script i ran . I want when the Contract Renewal Doctype is Approved the Contract end date in the Employee Doctype to change to the new contract end in the Contract Renewal. But its not working , Anyone who has an idea or view or any kind of help.
if doc.workflow_state == "Approved":
emp_doc = frappe.get_doc("Employee",doc.employee)
emp_doc.contract_end_date = doc.contract_end
emp_doc.save()
frappe.msgprint('The Contract End Date in the Employee record has been updated successfully.')
if doc.workflow_state == "Approved":
emp_doc = frappe.get_doc("Employee",doc.employee)
emp_doc.contract_end_date = doc.contract_end
emp_doc.save()
frappe.msgprint('The Contract End Date in the Employee record has been updated successfully.')