sales_invoice.py -- Check credit limit when make delivery is done from sales invoice.We need to check the credit limit as  there could be multiple partially paid sales order(note we are bypassing credit check at sales order) so we need to recheck credit balance of customer to avoid any delivery crossing credit limit from sales invoice.cint function is added.
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 30fb715..e21b95a 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -70,6 +70,7 @@
 		self.clear_unallocated_advances("Sales Invoice Advance", "advances")
 		self.add_remarks()
 		self.validate_write_off_account()
+		self.validate_duplicate_offline_pos_entry()
 		self.validate_account_for_change_amount()
 		self.validate_fixed_asset()
 		self.set_income_account_for_fixed_assets()
@@ -462,6 +463,12 @@
 		if flt(self.write_off_amount) and not self.write_off_account:
 			msgprint(_("Please enter Write Off Account"), raise_exception=1)
 
+	def validate_duplicate_offline_pos_entry(self):
+		if self.is_pos and self.offline_pos_name \
+			and frappe.db.get_value('Sales Invoice',
+			{'offline_pos_name': self.offline_pos_name, 'docstatus': 1}):
+			frappe.throw(_("Duplicate offline pos sales invoice {0}").format(self.offline_pos_name))
+
 	def validate_account_for_change_amount(self):
 		if flt(self.change_amount) and not self.account_for_change_amount:
 			msgprint(_("Please enter Account for Change Amount"), raise_exception=1)
@@ -919,7 +926,7 @@
 
 	    #PR : 10861, Author : ashish-greycube & jigneshpshah,  Email:mr.ashish.shah@gmail.com 
 		# Since the credit limit check is bypassed at sales order level, we need to check it at delivery note
-		bypass_credit_limit_check_at_sales_order = frappe.db.get_value("Customer", source.customer, "bypass_credit_limit_check_at_sales_order")
+		bypass_credit_limit_check_at_sales_order = cint(frappe.db.get_value("Customer", source.customer, "bypass_credit_limit_check_at_sales_order"))
 		if bypass_credit_limit_check_at_sales_order == 1:
 			from erpnext.selling.doctype.customer.customer import check_credit_limit
 			check_credit_limit(source.customer, source.company)
@@ -974,4 +981,4 @@
 def set_account_for_mode_of_payment(self):
 	for data in self.payments:
 		if not data.account:
-			data.account = get_bank_cash_account(data.mode_of_payment, self.company).get("account")
+			data.account = get_bank_cash_account(data.mode_of_payment, self.company).get("account")
\ No newline at end of file