fix: sequence of sub-operations in job card (#27138)

This commit is contained in:
rohitwaghchaure 2021-08-25 20:07:18 +05:30 committed by GitHub
parent 4d98be2126
commit ad45ddcabe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,17 +26,17 @@ class JobCard(Document):
self.set_status()
self.validate_operation_id()
self.validate_sequence_id()
self.get_sub_operations()
self.set_sub_operations()
self.update_sub_operation_status()
def get_sub_operations(self):
def set_sub_operations(self):
if self.operation:
self.sub_operations = []
for row in frappe.get_all("Sub Operation",
filters = {"parent": self.operation}, fields=["operation", "idx"]):
row.status = "Pending"
for row in frappe.get_all('Sub Operation',
filters = {'parent': self.operation}, fields=['operation', 'idx'], order_by='idx'):
row.status = 'Pending'
row.sub_operation = row.operation
self.append("sub_operations", row)
self.append('sub_operations', row)
def validate_time_logs(self):
self.total_time_in_mins = 0.0
@ -690,7 +690,7 @@ def make_corrective_job_card(source_name, operation=None, for_operation=None, ta
target.set('time_logs', [])
target.set('employee', [])
target.set('items', [])
target.get_sub_operations()
target.set_sub_operations()
target.get_required_items()
target.validate_time_logs()