[Bug-Fix] Cannot Save Bank Statement Transaction Entry (#15793)

* Create bank settings only if bank name is available

* Minor bug-fix in validate_overlap
This commit is contained in:
deepeshgarg007 2018-10-31 18:12:03 +05:30 committed by Nabin Hait
parent 71ede099ea
commit 78b273af43
2 changed files with 7 additions and 5 deletions

View File

@ -16,10 +16,11 @@ import copy
class BankStatementTransactionEntry(Document):
def autoname(self):
self.name = self.bank_account + "-" + self.from_date + "-" + self.to_date
mapper_name = self.bank + "-Statement-Settings"
if not frappe.db.exists("Bank Statement Settings", mapper_name):
self.create_settings(self.bank)
self.bank_settings = mapper_name
if self.bank:
mapper_name = self.bank + "-Statement-Settings"
if not frappe.db.exists("Bank Statement Settings", mapper_name):
self.create_settings(self.bank)
self.bank_settings = mapper_name
def create_settings(self, bank):
mapper = frappe.new_doc("Bank Statement Settings")

View File

@ -178,7 +178,8 @@ def validate_overlap(doc, from_date, to_date, company = None):
}, as_dict = 1)
if overlap_doc:
exists_for = doc.employee
if doc.get("employee"):
exists_for = doc.employee
if company:
exists_for = company
throw_overlap_error(doc, exists_for, overlap_doc[0].name, from_date, to_date)