Erpnext: Stock Entry: Manufacture - ZeroDivisionError: float division by zero

Created on 31 Jan 2020  ·  1Comment  ·  Source: frappe/erpnext

Hello!
After an update to ERPNext: v12.4.2 (version-12)&Frappe Framework: v12.2.1 (version-12), manufacturing doesn't work anymore.
The error appears when I’m trying to finish the manufacturing order. it opens the form which select the quantity manufactured, but when you press create, the error pops up.
I have two instances of Erpnext. The one with the problem is “production”, the other one is “develop”, which works well.
The workflow for manufacturing is : work order -> material transfer to WIP -> material consumption -> manufacture(stock entry - transfer of finished goods to warehouse). first two stock entries works fine, the last one not. The difference that I found between develop and production is that in "develop", Item section in manufacture stock entry has finished goods on the table, and in "production" has the raw materials used for manufacturing the goods. Probably the items are fetched from the wrong source.

here is the error log:

[ERROR] 2020-01-29 11:23:08,384 | /home/frappe/frappe-bench/apps/frappe/frappe/app.py:
Site: fmc.test
Form Dict: {
“cmd”: “erpnext.manufacturing.doctype.work_order.work_order.make_stock_entry”,
“purpose”: “Manufacture”,
“qty”: “5”,
“work_order_id”: “MFG-WO-2020-00001”
}
Request Error
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 60, in application
response = frappe.api.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/api.py”, line 55, in handle
return frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 22, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 61, in execute_cmd
return frappe.call(method, *frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1042, in call
return fn(
args, **newargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/manufacturing/doctype/work_order/work_order.py”, line 675, in make_stock_entry
stock_entry.get_items()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py”, line 887, in get_items
self.calculate_rate_and_amount(raise_error_if_no_rate=False)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py”, line 419, in calculate_rate_and_amount
self.set_basic_rate(force, update_finished_item_rate, raise_error_if_no_rate)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py”, line 462, in set_basic_rate
self.set_basic_rate_for_finished_goods(raw_material_cost, scrap_material_cost)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py”, line 490, in set_basic_rate_for_finished_goods
d.basic_rate = flt((raw_material_cost - scrap_material_cost) / flt(d.transfer_qty), d.precision(“basic_rate”))
ZeroDivisionError: float division by zero

[ERROR] 2020-01-29 17:17:46,666 | /home/frappe/frappe-bench/apps/frappe/frappe/app.py:
Site: site1.local
Form Dict: {
“cmd”: “erpnext.manufacturing.doctype.work_order.work_order.make_stock_entry”,
“purpose”: “Manufacture”,
“qty”: “10”,
“work_order_id”: “MFG-WO-2020-00001”
}
Request Error
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 60, in application
response = frappe.api.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/api.py”, line 55, in handle
return frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 22, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 61, in execute_cmd
return frappe.call(method, *frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1042, in call
return fn(
args, **newargs)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/manufacturing/doctype/work_order/work_order.py”, line 675, in make_stock_entry
stock_entry.get_items()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py”, line 887, in get_items
self.calculate_rate_and_amount(raise_error_if_no_rate=False)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py”, line 419, in calculate_rate_and_amount
self.set_basic_rate(force, update_finished_item_rate, raise_error_if_no_rate)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py”, line 462, in set_basic_rate
self.set_basic_rate_for_finished_goods(raw_material_cost, scrap_material_cost)
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/stock/doctype/stock_entry/stock_entry.py”, line 490, in set_basic_rate_for_finished_goods
d.basic_rate = flt((raw_material_cost - scrap_material_cost) / flt(d.transfer_qty), d.precision(“basic_rate”))
ZeroDivisionError: float division by zero

ERPNext: v12.4.2 (version-12)
Frappe Framework: v12.2.1 (version-12)
Ubuntu 16.04

bug

Most helpful comment

>All comments

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Fredoluka picture Fredoluka  ·  3Comments

alimalkhalifa picture alimalkhalifa  ·  3Comments

nabinhait picture nabinhait  ·  3Comments

giuseppelamatrice picture giuseppelamatrice  ·  3Comments

rmehta picture rmehta  ·  3Comments