69 lines
2.8 KiB
Python
69 lines
2.8 KiB
Python
def execute():
|
|
import webnotes
|
|
from webnotes.modules.module_manager import reload_doc
|
|
from webnotes.model import delete_doc
|
|
sql = webnotes.conn.sql
|
|
|
|
# Production Planning Tool
|
|
#---------------------------------------------------------------
|
|
delete_doc('DocType', 'PP Detail')
|
|
delete_doc('DocType', 'PP SO Detail')
|
|
delete_doc('DocType', 'Production Planning Tool')
|
|
|
|
reload_doc('production', 'doctype', 'production_planning_tool')
|
|
reload_doc('production', 'doctype', 'pp_detail')
|
|
reload_doc('production', 'doctype', 'pp_so_detail')
|
|
|
|
# Production Order
|
|
#---------------------------------------------------------------
|
|
|
|
reload_doc('production', 'doctype', 'production_order')
|
|
|
|
sql("""delete from `tabDocField` where parent = 'Production Order'
|
|
and (label in ('Material Transfer', 'Backflush', 'Stop Production Order', 'Unstop Production Order')
|
|
or fieldname = 'transaction_date')
|
|
""")
|
|
|
|
|
|
# Bill Of Materials
|
|
#---------------------------------------------------------------
|
|
reload_doc('production', 'doctype', 'bill_of_materials')
|
|
relaod_doc('production', 'doctype', 'bom_material')
|
|
relaod_doc('production', 'doctype', 'bom_operation')
|
|
relaod_doc('production', 'doctype', 'flat_bom_detail')
|
|
|
|
#copy values
|
|
sql("""update `tabBill Of Materials` set rm_cost_as_per = 'Valuation Rate',
|
|
raw_material_cost = dir_mat_as_per_mar, total_cost = cost_as_per_mar, costing_date = cost_as_on""")
|
|
|
|
sql("update `tabBOM Material` set rate = moving_avg_rate, amount = amount_as_per_mar")
|
|
|
|
sql("update `tabFlat Bom Detail` set rate = moving_average_rate, amount = amount_as_per_mar")
|
|
|
|
|
|
|
|
# delete depricated flds from bom
|
|
sql(""" delete from `tabDocField` where parent = 'Bill Of Materials'
|
|
and (
|
|
label in ('TreeView1', 'Set as Default BOM', 'Activate BOM', 'Inactivate BOM')
|
|
or fieldname in ('cost_as_per_mar', 'cost_as_per_lpr', 'cost_as_per_sr', 'cost_as_on',
|
|
'dir_mat_as_per_mar', 'dir_mat_as_per_lpr', 'dir_mat_as_per_sr')
|
|
)
|
|
""")
|
|
|
|
# delete depricated flds from bom operation
|
|
sql("delete from `tabDocField` where parent = 'BOM Operation' and fieldname in ('details', 'workstation_capacity')")
|
|
|
|
# delete depricated flds from bom material
|
|
sql("""delete from `tabDocField` where parent = 'BOM Material'
|
|
and fieldname in ('dir_mat_as_per_mar', 'dir_mat_as_per_sr', 'dir_mat_as_per_lpr', 'operating_cost', 'value_as_per_mar',
|
|
'value_as_per_sr', 'value_as_per_lpr', 'moving_avg_rate', 'standard_rate', 'last_purchase_rate', 'amount_as_per_sr',
|
|
'amount_as_per_lpr', 'amount_as_per_mar')
|
|
""")
|
|
|
|
# delete depricated flds from flat bom
|
|
sql("""delete from tabDocField where parent = 'Flat BOM Detail'
|
|
and fieldname in ('moving_avg_rate', 'standard_rate', 'last_purchase_rate', 'amount_as_per_mar',
|
|
'amount_as_per_sr', 'amount_as_per_lpr', 'flat_bom_no', 'bom_mat_no', 'is_pro_applicable')
|
|
""")
|