-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manufacturing Over/Under Production #50
Conversation
@HKuz This is ready for review, thanks! |
This looks great, @fproldan ! Only thing I uncovered was the last test def test_validate_job_card():
work_order = frappe.get_doc("Work Order", {"item_name": "Ambrosia Pie"})
jc = frappe.get_doc("Job Card", {"work_order": work_order.name, "operation": work_order.operations[0].operation})
jc.cancel()
job_card = create_job_card(work_order, work_order.operations[0].as_dict(), auto_create=True)
job_card.append(
"time_logs",
{
"from_time": now(),
"to_time": now(),
"completed_qty": work_order.qty,
},
)
job_card.save()
assert job_card.validate_job_card() == None
overproduction_percentage_for_work_order = frappe.db.get_value(
"BOM", work_order.bom_no, "overproduction_percentage_for_work_order"
)
over_production_qty = work_order.qty * (1 + overproduction_percentage_for_work_order / 100)
job_card.time_logs[0].completed_qty = over_production_qty
job_card.save()
assert job_card.validate_job_card() == None
job_card.time_logs[0].completed_qty = over_production_qty + 10
job_card.save()
with pytest.raises(ValidationError) as exc_info:
job_card.validate_job_card()
assert (
f"The <strong>Total Completed Qty</strong> (<strong>{over_production_qty + 10}</strong>) must be equal to <strong>Qty to Manufacture</strong> (<strong>{job_card.for_quantity}</strong>)"
in exc_info.value.args[0]
) |
@HKuz Thanks! Let me know if is passing now. |
@fproldan - I think it was a version issue. I updated my ERPNext and Frappe apps locally and I no longer get the error when there's already a completed Job Card in place for a work order. (It still wants those strong tags, though? If it's passing in CI should be fine but we can always do a replace to remove the tags before we compare strings if it causes a problem). |
#40