[Fix] Indentation for accounting_period overlap
This commit is contained in:
parent
9502476c67
commit
32b3aa257c
@ -15,20 +15,20 @@ class AccountingPeriod(Document):
|
|||||||
self.name = " - ".join([self.period_name, company_abbr])
|
self.name = " - ".join([self.period_name, company_abbr])
|
||||||
|
|
||||||
def validate_overlap(self):
|
def validate_overlap(self):
|
||||||
existing_accounting_period = frappe.db.sql("""select name from `tabAccounting Period`
|
existing_accounting_period = frappe.db.sql("""select name from `tabAccounting Period`
|
||||||
where (
|
where (
|
||||||
(%(start_date)s between start_date and end_date)
|
(%(start_date)s between start_date and end_date)
|
||||||
or (%(end_date)s between start_date and end_date)
|
or (%(end_date)s between start_date and end_date)
|
||||||
or (start_date between %(start_date)s and %(end_date)s)
|
or (start_date between %(start_date)s and %(end_date)s)
|
||||||
or (end_date between %(start_date)s and %(end_date)s)
|
or (end_date between %(start_date)s and %(end_date)s)
|
||||||
) and name!=%(name)s and company=%(company)s""",
|
) and name!=%(name)s and company=%(company)s""",
|
||||||
{
|
{
|
||||||
"start_date": self.start_date,
|
"start_date": self.start_date,
|
||||||
"end_date": self.end_date,
|
"end_date": self.end_date,
|
||||||
"name": self.name,
|
"name": self.name,
|
||||||
"company": self.company
|
"company": self.company
|
||||||
}, as_dict=True)
|
}, as_dict=True)
|
||||||
|
|
||||||
if len(existing_accounting_period) > 0:
|
if len(existing_accounting_period) > 0:
|
||||||
frappe.throw("Accounting Period overlaps with {0}".format(existing_accounting_period[0].get("name")))
|
frappe.throw("Accounting Period overlaps with {0}".format(existing_accounting_period[0].get("name")))
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user