mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 16:34:46 +00:00
stock entry cleanup
This commit is contained in:
@@ -3,8 +3,8 @@ import webnotes
|
||||
def execute():
|
||||
delete_doctypes()
|
||||
rename_module()
|
||||
rebuilt_exploded_bom()
|
||||
cleanup_bom()
|
||||
rebuild_exploded_bom()
|
||||
|
||||
def delete_doctypes():
|
||||
from webnotes.model import delete_doc
|
||||
@@ -36,12 +36,14 @@ def rename_module():
|
||||
# set end of life to null if "0000-00-00"
|
||||
webnotes.conn.sql("""update `tabItem` set end_of_life=null where end_of_life='0000-00-00'""")
|
||||
|
||||
def rebuilt_exploded_bom():
|
||||
def rebuild_exploded_bom():
|
||||
from webnotes.model.code import get_obj
|
||||
for bom in webnotes.conn.sql("""select name from `tabBOM` where docstatus < 2"""):
|
||||
get_obj("BOM", bom[0], with_children=1).on_update()
|
||||
|
||||
def cleanup_bom():
|
||||
webnotes.conn.sql("""UPDATE `tabBOM` SET is_active = if(is_active in ('Yes', 1), 1, 0),
|
||||
with_operations = 1""")
|
||||
webnotes.conn.sql("""UPDATE `tabBOM` SET is_active = 1 where ifnull(is_active, 'No') = 'Yes'""")
|
||||
webnotes.conn.sql("""UPDATE `tabBOM` SET is_active = 0 where ifnull(is_active, 'No') = 'No'""")
|
||||
webnotes.reload_doc("manufacturing", "doctype", "bom")
|
||||
webnotes.conn.sql("""update `tabBOM` set with_operations = 1""")
|
||||
|
||||
@@ -12,35 +12,35 @@ def custom_fields():
|
||||
"fieldname": "is_excisable_goods",
|
||||
"fieldtype": "Select",
|
||||
"options": "\nYes\nNo",
|
||||
"insert_after": "company"
|
||||
"insert_after": "Company"
|
||||
},
|
||||
{
|
||||
"label": "Excisable Goods",
|
||||
"fieldname": "excisable_goods",
|
||||
"fieldtype": "Select",
|
||||
"options": "\nReturnable\nNon-Returnable)",
|
||||
"insert_after": "amended_from"
|
||||
"insert_after": "Amended From"
|
||||
},
|
||||
{
|
||||
"label": "Under Rule",
|
||||
"fieldname": "under_rule",
|
||||
"fieldtype": "Select",
|
||||
"options": "\nOrdinary\n57 AC (5) a\n57 F (2) Non-Exc.",
|
||||
"insert_after": "remarks"
|
||||
"insert_after": "Remarks"
|
||||
},
|
||||
{
|
||||
"label": "Transporter",
|
||||
"fieldname": "transporter",
|
||||
"fieldtype": "Data",
|
||||
"options": "",
|
||||
"insert_after": "project_name"
|
||||
"insert_after": "Project Name"
|
||||
},
|
||||
{
|
||||
"label": "Transfer Date",
|
||||
"fieldname": "transfer_date",
|
||||
"fieldtype": "Date",
|
||||
"options": "",
|
||||
"insert_after": "select_print_heading"
|
||||
"insert_after": "Select Print Heading"
|
||||
},
|
||||
]
|
||||
|
||||
@@ -62,9 +62,13 @@ def create_custom_field(fld):
|
||||
|
||||
def deprecate_process():
|
||||
webnotes.conn.sql("""update `tabStock Entry`
|
||||
set `purpose`="Production Order - Material Transfer"
|
||||
set `purpose`="Material Transfer"
|
||||
where process="Material Transfer" and purpose="Production Order" """)
|
||||
|
||||
webnotes.conn.sql("""update `tabStock Entry`
|
||||
set `purpose`="Production Order - Update Finished Goods"
|
||||
where process="Backflush" and purpose="Production Order" """)
|
||||
set `purpose`="Manufacture/Repack"
|
||||
where (process="Backflush" and purpose="Production Order") or purpose="Other" """)
|
||||
|
||||
webnotes.conn.sql("""update `tabStock Entry`
|
||||
set `purpose`="Subcontract"
|
||||
where process="Subcontracting" """)
|
||||
@@ -542,4 +542,8 @@ patch_list = [
|
||||
'patch_module': 'patches.december_2012',
|
||||
'patch_file': 'clear_web_cache',
|
||||
},
|
||||
{
|
||||
'patch_module': 'patches.december_2012',
|
||||
'patch_file': 'stock_entry_cleanup',
|
||||
},
|
||||
]
|
||||
Reference in New Issue
Block a user