frappe / erpnext

Free and Open Source Enterprise Resource Planning (ERP)
https://erpnext.com
GNU General Public License v3.0
17.56k stars 6.71k forks source link

Incorrect operations time calculation in new Work Order from BOM. #37485

Open tfcloete opened 8 months ago

tfcloete commented 8 months ago

Information about bug

When creating a Work Order from a BOM, with qty > 1, that has a (non-fixed time) operation with batch size > 1, the resulting operations time in the Work Order is incorrect.

Example:

Current: BOMQty = 2; operations time = 4; batch size = 2 ===> WOQty = 2; operations time = 2
Expected: BOMQty = 2; operations time = 4; batch size = 2 ===> WOQty = 2; operations time = 4

Module

manufacturing

Version

v14.35.2

Installation method

docker

Relevant log output / Stack trace / Full Error Message.

No response

tfcloete commented 3 months ago

Suggested Fix: def _get_operations(bom_no, qty=1): data = frappe.get_all( "BOM Operation", filters={"parent": bom_no}, fields=[ "operation", "description", "workstation", "idx", "workstation_type", "base_hour_rate as hour_rate", "time_in_mins", "parent as bom", "batch_size", "sequence_id", "fixed_time", ], order_by="idx", ) for d in data: if not d.fixed_time:

tfcloete commented 3 months ago

I apologise for the incorrect format of the commit message.