refactor: Folio no validation
diff --git a/erpnext/accounts/doctype/share_transfer/share_transfer.py b/erpnext/accounts/doctype/share_transfer/share_transfer.py
index 65f248e..d4aa0f0 100644
--- a/erpnext/accounts/doctype/share_transfer/share_transfer.py
+++ b/erpnext/accounts/doctype/share_transfer/share_transfer.py
@@ -168,10 +168,12 @@
return 'Outside'
def folio_no_validation(self):
- shareholders = ['from_shareholder', 'to_shareholder']
- shareholders = [shareholder for shareholder in shareholders if self.get(shareholder) is not '']
- for shareholder in shareholders:
- doc = self.get_shareholder_doc(self.get(shareholder))
+ shareholder_fields = ['from_shareholder', 'to_shareholder']
+ for shareholder_field in shareholder_fields:
+ shareholder_name = self.get(shareholder_field)
+ if not shareholder_name:
+ continue
+ doc = self.get_shareholder_doc(shareholder_name)
if doc.company != self.company:
frappe.throw(_('The shareholder does not belong to this company'))
if not doc.folio_no: