fix: allow to make job card without employee

This commit is contained in:
Rohit Waghchaure 2021-07-03 17:22:09 +05:30
parent 877597bc16
commit 3105332e3c

View File

@ -192,15 +192,20 @@ class JobCard(Document):
"completed_qty": args.get("completed_qty") or 0.0
})
elif args.get("start_time"):
for name in employees:
self.append("time_logs", {
new_args = {
"from_time": get_datetime(args.get("start_time")),
"employee": name.get('employee'),
"operation": args.get("sub_operation"),
"completed_qty": 0.0
})
}
if not self.employee:
if employees:
for name in employees:
new_args.employee = name.get('employee')
self.add_start_time_log(new_args)
else:
self.add_start_time_log(new_args)
if not self.employee and employees:
self.set_employees(employees)
if self.status == "On Hold":
@ -208,6 +213,9 @@ class JobCard(Document):
self.save()
def add_start_time_log(self, args):
self.append("time_logs", args)
def set_employees(self, employees):
for name in employees:
self.append('employee', {