[ Enhance ] Production to Work Order (#12902)

* remove occurrences of Production Order

* rename from report and jsons

* Change Production Order to Work Order

* change occurences of production order from other files

* resolve minor conflict issues and reports

* patch added

* codacy fix

* updated patches, leftover changes

* rename reports, rectify patches
This commit is contained in:
Zarrar
2018-03-20 12:38:43 +05:30
committed by Nabin Hait
parent c893268dea
commit 13ddc7e188
93 changed files with 902 additions and 710 deletions

View File

@@ -7,7 +7,7 @@ import frappe, random, erpnext
from frappe.utils.make_random import how_many
from frappe.desk import query_report
from erpnext.manufacturing.doctype.workstation.workstation import WorkstationHolidayError
from erpnext.manufacturing.doctype.production_order.test_production_order import make_prod_order_test_record
from erpnext.manufacturing.doctype.work_order.test_work_order import make_prod_order_test_record
def work():
frappe.set_user(frappe.db.get_global('demo_manufacturing_user'))
@@ -21,13 +21,13 @@ def work():
ppt.purchase_request_for_warehouse = "Stores - WPL"
ppt.run_method("get_open_sales_orders")
ppt.run_method("get_items")
ppt.run_method("raise_production_orders")
ppt.run_method("raise_work_orders")
ppt.run_method("raise_material_requests")
frappe.db.commit()
# submit production orders
for pro in frappe.db.get_values("Production Order", {"docstatus": 0}, "name"):
b = frappe.get_doc("Production Order", pro[0])
# submit work orders
for pro in frappe.db.get_values("Work Order", {"docstatus": 0}, "name"):
b = frappe.get_doc("Work Order", pro[0])
b.wip_warehouse = "Work in Progress - WPL"
b.submit()
frappe.db.commit()
@@ -40,12 +40,12 @@ def work():
# stores -> wip
if random.random() < 0.3:
for pro in query_report.run("Open Production Orders")["result"][:how_many("Stock Entry for WIP")]:
for pro in query_report.run("Open Work Orders")["result"][:how_many("Stock Entry for WIP")]:
make_stock_entry_from_pro(pro[0], "Material Transfer for Manufacture")
# wip -> fg
if random.random() < 0.3:
for pro in query_report.run("Production Orders in Progress")["result"][:how_many("Stock Entry for FG")]:
for pro in query_report.run("Work Orders in Progress")["result"][:how_many("Stock Entry for FG")]:
make_stock_entry_from_pro(pro[0], "Manufacture")
for bom in frappe.get_all('BOM', fields=['item'], filters = {'with_operations': 1}):
@@ -57,7 +57,7 @@ def work():
# submit time logs
for timesheet in frappe.get_all("Timesheet", ["name"], {"docstatus": 0,
"production_order": ("!=", ""), "to_time": ("<", frappe.flags.current_date)}):
"work_order": ("!=", ""), "to_time": ("<", frappe.flags.current_date)}):
timesheet = frappe.get_doc("Timesheet", timesheet.name)
try:
timesheet.submit()
@@ -68,10 +68,10 @@ def work():
pass
def make_stock_entry_from_pro(pro_id, purpose):
from erpnext.manufacturing.doctype.production_order.production_order import make_stock_entry
from erpnext.manufacturing.doctype.work_order.work_order import make_stock_entry
from erpnext.stock.stock_ledger import NegativeStockError
from erpnext.stock.doctype.stock_entry.stock_entry import IncorrectValuationRateError, \
DuplicateEntryForProductionOrderError, OperationsNotCompleteError
DuplicateEntryForWorkOrderError, OperationsNotCompleteError
try:
st = frappe.get_doc(make_stock_entry(pro_id, purpose))
@@ -83,6 +83,6 @@ def make_stock_entry_from_pro(pro_id, purpose):
frappe.db.commit()
st.submit()
frappe.db.commit()
except (NegativeStockError, IncorrectValuationRateError, DuplicateEntryForProductionOrderError,
except (NegativeStockError, IncorrectValuationRateError, DuplicateEntryForWorkOrderError,
OperationsNotCompleteError):
frappe.db.rollback()