Merge branch 'production' of github.com:webnotes/erpnext into production

Conflicts:
	accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt
	buying/doctype/purchase_order_item/purchase_order_item.txt
	buying/doctype/supplier_quotation_item/supplier_quotation_item.txt
	patches/patch_list.py
This commit is contained in:
Anand Doshi
2012-12-19 22:28:00 +05:30
537 changed files with 27532 additions and 39772 deletions

View File

@@ -0,0 +1,49 @@
import webnotes
def execute():
delete_doctypes()
rename_module()
cleanup_bom()
rebuild_exploded_bom()
def delete_doctypes():
from webnotes.model import delete_doc
delete_doc("DocType", "Production Control")
delete_doc("DocType", "BOM Control")
def rename_module():
webnotes.reload_doc("core", "doctype", "role")
webnotes.reload_doc("core", "doctype", "page")
webnotes.reload_doc("core", "doctype", "module_def")
if webnotes.conn.exists("Role", "Production User"):
webnotes.rename_doc("Role", "Production User", "Manufacturing User")
if webnotes.conn.exists("Role", "Production Manager"):
webnotes.rename_doc("Role", "Production Manager", "Manufacturing Manager")
if webnotes.conn.exists("Page", "manufacturing-home"):
webnotes.delete_doc("Page", "production-home")
else:
webnotes.rename_doc("Page", "production-home", "manufacturing-home")
if webnotes.conn.exists("Module Def", "Production"):
webnotes.rename_doc("Module Def", "Production", "Manufacturing")
webnotes.conn.set_global("modules_list",
webnotes.conn.get_global('modules_list').replace("Production", "Manufacturing"))
# 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 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 = 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""")

View File

@@ -0,0 +1,74 @@
import webnotes
def execute():
# removed following fields
custom_fields()
deprecate_process()
webnotes.delete_doc("doctype", "sandbox")
def custom_fields():
fields = [
{
"label": "Is Excisable Goods",
"fieldname": "is_excisable_goods",
"fieldtype": "Select",
"options": "\nYes\nNo",
"insert_after": "Company"
},
{
"label": "Excisable Goods",
"fieldname": "excisable_goods",
"fieldtype": "Select",
"options": "\nReturnable\nNon-Returnable)",
"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"
},
{
"label": "Transporter",
"fieldname": "transporter",
"fieldtype": "Data",
"options": "",
"insert_after": "Project Name"
},
{
"label": "Transfer Date",
"fieldname": "transfer_date",
"fieldtype": "Date",
"options": "",
"insert_after": "Select Print Heading"
},
]
for fld in fields:
if webnotes.conn.sql("""select name from `tabStock Entry`
where ifnull(%s, '') != '' and docstatus<2""", (fld['fieldname'])):
create_custom_field(fld)
def create_custom_field(fld):
fld.update({
"doctype": "Custom Field",
"dt": "Stock Entry",
"print_hide": 1,
"permlevel": 0
})
from webnotes.model.doclist import DocList
webnotes.insert(DocList([fld]))
def deprecate_process():
webnotes.conn.sql("""update `tabStock Entry`
set `purpose`="Material Transfer"
where process="Material Transfer" and purpose="Production Order" """)
webnotes.conn.sql("""update `tabStock Entry`
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" """)