
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _

class TrainingFeedback(Document):
	def validate(self):
		training_event = frappe.get_doc("Training Event", self.training_event)
		if training_event.docstatus != 1:
			frappe.throw(_('{0} must be submitted').format(_('Training Event')))

	def on_submit(self):
		training_event = frappe.get_doc("Training Event", self.training_event)
		status = None
		for e in training_event.employees:
			if e.employee == self.employee:
				status = 'Feedback Submitted'
				break

		if status:
			frappe.db.set_value("Training Event", self.training_event, "status", status)


from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _

class TrainingFeedback(Document):
	def validate(self):
		training_event = frappe.get_doc("Training Event", self.training_event)
		if training_event.docstatus != 1:
			frappe.throw(_('{0} must be submitted').format(_('Training Event')))

	def on_submit(self):
		training_event = frappe.get_doc("Training Event", self.training_event)
		event_status = None
		for e in training_event.employees:
			if e.employee == self.employee:
				event_status = 'Feedback Submitted'
				break

		if event_status:
			frappe.db.set_value("Training Event", self.training_event, "event_status", event_status)

Use event_status instead of status
fix(hr): Use event_status instead of status

Training Feedback DocType has event_status field (not status)
This was broken since PR #10379, PR #17197 made this failure explicit.

  
  from __future__ import unicode_literals
  import frappe
  from frappe.model.document import Document
  from frappe import _
  
  class TrainingFeedback(Document):
  	def validate(self):
  		training_event = frappe.get_doc("Training Event", self.training_event)
  		if training_event.docstatus != 1:
  			frappe.throw(_('{0} must be submitted').format(_('Training Event')))
  
  	def on_submit(self):
  		training_event = frappe.get_doc("Training Event", self.training_event)
- 		status = None
+ 		event_status = None
  		for e in training_event.employees:
  			if e.employee == self.employee:
- 				status = 'Feedback Submitted'
+ 				event_status = 'Feedback Submitted'
  				break
  
- 		if status:
+ 		if event_status:
- 			frappe.db.set_value("Training Event", self.training_event, "status", status)
+ 			frappe.db.set_value("Training Event", self.training_event, "event_status", event_status)
  
Use event_status instead of status
## Code Before:

from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _

class TrainingFeedback(Document):
	def validate(self):
		training_event = frappe.get_doc("Training Event", self.training_event)
		if training_event.docstatus != 1:
			frappe.throw(_('{0} must be submitted').format(_('Training Event')))

	def on_submit(self):
		training_event = frappe.get_doc("Training Event", self.training_event)
		status = None
		for e in training_event.employees:
			if e.employee == self.employee:
				status = 'Feedback Submitted'
				break

		if status:
			frappe.db.set_value("Training Event", self.training_event, "status", status)

## Instruction:
Use event_status instead of status
## Code After:

from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _

class TrainingFeedback(Document):
	def validate(self):
		training_event = frappe.get_doc("Training Event", self.training_event)
		if training_event.docstatus != 1:
			frappe.throw(_('{0} must be submitted').format(_('Training Event')))

	def on_submit(self):
		training_event = frappe.get_doc("Training Event", self.training_event)
		event_status = None
		for e in training_event.employees:
			if e.employee == self.employee:
				event_status = 'Feedback Submitted'
				break

		if event_status:
			frappe.db.set_value("Training Event", self.training_event, "event_status", event_status)
