mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
refactor(treewide): formatting and ruff fixes, + manually enabled F401
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
@@ -163,7 +163,7 @@ class MaintenanceSchedule(TransactionBase):
|
||||
date_diff = (getdate(end_date) - getdate(start_date)).days
|
||||
add_by = date_diff / no_of_visit
|
||||
|
||||
for visit in range(cint(no_of_visit)):
|
||||
for _visit in range(cint(no_of_visit)):
|
||||
if getdate(start_date_copy) < getdate(end_date):
|
||||
start_date_copy = add_days(start_date_copy, add_by)
|
||||
if len(schedule_list) < no_of_visit:
|
||||
@@ -190,9 +190,8 @@ class MaintenanceSchedule(TransactionBase):
|
||||
)
|
||||
|
||||
if not validated and holidays:
|
||||
|
||||
# max iterations = len(holidays)
|
||||
for i in range(len(holidays)):
|
||||
for _i in range(len(holidays)):
|
||||
if schedule_date in holidays:
|
||||
schedule_date = add_days(schedule_date, -1)
|
||||
else:
|
||||
@@ -251,7 +250,7 @@ class MaintenanceSchedule(TransactionBase):
|
||||
doc_before_save = self.get_doc_before_save()
|
||||
if not doc_before_save:
|
||||
return
|
||||
for prev_item, item in zip(doc_before_save.items, self.items):
|
||||
for prev_item, item in zip(doc_before_save.items, self.items, strict=False):
|
||||
fields = [
|
||||
"item_code",
|
||||
"start_date",
|
||||
@@ -334,9 +333,7 @@ class MaintenanceSchedule(TransactionBase):
|
||||
)
|
||||
)
|
||||
|
||||
if sr_details.amc_expiry_date and getdate(sr_details.amc_expiry_date) >= getdate(
|
||||
amc_start_date
|
||||
):
|
||||
if sr_details.amc_expiry_date and getdate(sr_details.amc_expiry_date) >= getdate(amc_start_date):
|
||||
throw(
|
||||
_("Serial No {0} is under maintenance contract upto {1}").format(
|
||||
serial_no, sr_details.amc_expiry_date
|
||||
|
||||
@@ -69,13 +69,17 @@ class MaintenanceVisit(TransactionBase):
|
||||
self.mntc_date
|
||||
) > get_datetime(end_date):
|
||||
frappe.throw(
|
||||
_("Date must be between {0} and {1}").format(format_date(start_date), format_date(end_date))
|
||||
_("Date must be between {0} and {1}").format(
|
||||
format_date(start_date), format_date(end_date)
|
||||
)
|
||||
)
|
||||
else:
|
||||
for purpose in self.purposes:
|
||||
if purpose.maintenance_schedule_detail:
|
||||
item_ref = frappe.db.get_value(
|
||||
"Maintenance Schedule Detail", purpose.maintenance_schedule_detail, "item_reference"
|
||||
"Maintenance Schedule Detail",
|
||||
purpose.maintenance_schedule_detail,
|
||||
"item_reference",
|
||||
)
|
||||
if item_ref:
|
||||
start_date, end_date = frappe.db.get_value(
|
||||
|
||||
Reference in New Issue
Block a user