fix: existing logical error

This commit is contained in:
Mihir Kandoi
2025-01-28 16:56:05 +05:30
parent 1be19819fb
commit 6c4655dd72
2 changed files with 3 additions and 3 deletions

View File

@@ -791,7 +791,7 @@ class JobCard(Document):
fields=["total_time_in_mins", "hour_rate"], fields=["total_time_in_mins", "hour_rate"],
filters={"is_corrective_job_card": 1, "docstatus": 1, "work_order": self.work_order}, filters={"is_corrective_job_card": 1, "docstatus": 1, "work_order": self.work_order},
): ):
wo.corrective_operation_cost += flt(row.total_time_in_mins) * flt(row.hour_rate) wo.corrective_operation_cost += (flt(row.total_time_in_mins) / 60) * flt(row.hour_rate)
wo.calculate_operating_cost() wo.calculate_operating_cost()
wo.flags.ignore_validate_update_after_submit = True wo.flags.ignore_validate_update_after_submit = True

View File

@@ -451,7 +451,6 @@ class TestJobCard(FrappeTestCase):
job_card.name, operation=corrective_action.name, for_operation=job_card.operation job_card.name, operation=corrective_action.name, for_operation=job_card.operation
) )
corrective_job_card.hour_rate = 100 corrective_job_card.hour_rate = 100
corrective_job_card.update({"hour_rate": 100})
corrective_job_card.insert() corrective_job_card.insert()
corrective_job_card.append( corrective_job_card.append(
"time_logs", "time_logs",
@@ -461,7 +460,6 @@ class TestJobCard(FrappeTestCase):
"completed_qty": 4, "completed_qty": 4,
}, },
) )
print(corrective_job_card.as_dict())
corrective_job_card.submit() corrective_job_card.submit()
wo.reload() wo.reload()
@@ -479,8 +477,10 @@ class TestJobCard(FrappeTestCase):
wo.name, wo.name,
[{"name": wo.operations[0].name, "operation": "_Test Operation 1", "qty": 3, "pending_qty": 3}], [{"name": wo.operations[0].name, "operation": "_Test Operation 1", "qty": 3, "pending_qty": 3}],
) )
workstation = job_card.workstation
job_card = frappe.get_last_doc("Job Card", {"work_order": wo.name}) job_card = frappe.get_last_doc("Job Card", {"work_order": wo.name})
job_card.update({"for_quantity": 3}) job_card.update({"for_quantity": 3})
job_card.workstation = workstation
job_card.append( job_card.append(
"time_logs", "time_logs",
{ {