
from __future__ import unicode_literals

from frappe.model.document import Document

class DocField(Document):
	pass


from __future__ import unicode_literals

import frappe
from frappe.model.document import Document

class DocField(Document):
	def get_link_doctype(self):
		'''Returns the Link doctype for the docfield (if applicable)
		if fieldtype is Link: Returns "options"
		if fieldtype is Table MultiSelect: Returns "options" of the Link field in the Child Table
		'''
		if self.fieldtype == 'Link':
			return self.options

		if self.fieldtype == 'Table MultiSelect':
			table_doctype = self.options

			link_doctype = frappe.db.get_value('DocField', {
				'fieldtype': 'Link',
				'parenttype': 'DocType',
				'parent': table_doctype,
				'in_list_view': 1
			}, 'options')

			return link_doctype

Add get_link_doctype method in DocField
fix: Add get_link_doctype method in DocField

  
  from __future__ import unicode_literals
  
+ import frappe
  from frappe.model.document import Document
  
  class DocField(Document):
- 	pass
+ 	def get_link_doctype(self):
+ 		'''Returns the Link doctype for the docfield (if applicable)
+ 		if fieldtype is Link: Returns "options"
+ 		if fieldtype is Table MultiSelect: Returns "options" of the Link field in the Child Table
+ 		'''
+ 		if self.fieldtype == 'Link':
+ 			return self.options
  
+ 		if self.fieldtype == 'Table MultiSelect':
+ 			table_doctype = self.options
+ 
+ 			link_doctype = frappe.db.get_value('DocField', {
+ 				'fieldtype': 'Link',
+ 				'parenttype': 'DocType',
+ 				'parent': table_doctype,
+ 				'in_list_view': 1
+ 			}, 'options')
+ 
+ 			return link_doctype
+ 
Add get_link_doctype method in DocField
## Code Before:

from __future__ import unicode_literals

from frappe.model.document import Document

class DocField(Document):
	pass

## Instruction:
Add get_link_doctype method in DocField
## Code After:

from __future__ import unicode_literals

import frappe
from frappe.model.document import Document

class DocField(Document):
	def get_link_doctype(self):
		'''Returns the Link doctype for the docfield (if applicable)
		if fieldtype is Link: Returns "options"
		if fieldtype is Table MultiSelect: Returns "options" of the Link field in the Child Table
		'''
		if self.fieldtype == 'Link':
			return self.options

		if self.fieldtype == 'Table MultiSelect':
			table_doctype = self.options

			link_doctype = frappe.db.get_value('DocField', {
				'fieldtype': 'Link',
				'parenttype': 'DocType',
				'parent': table_doctype,
				'in_list_view': 1
			}, 'options')

			return link_doctype
