2020-08-12 12:25:02 +00:00
|
|
|
# Copyright(c) 2020, Frappe Technologies Pvt.Ltd.and Contributors
|
|
|
|
# License: GNU General Public License v3.See license.txt
|
|
|
|
|
|
|
|
from __future__ import unicode_literals
|
2021-09-02 11:14:59 +00:00
|
|
|
|
2020-08-12 12:25:02 +00:00
|
|
|
import frappe
|
|
|
|
|
2021-09-02 11:14:59 +00:00
|
|
|
|
2020-08-12 12:25:02 +00:00
|
|
|
def execute():
|
|
|
|
frappe.reload_doc("stock", "doctype", "stock_entry")
|
|
|
|
if frappe.db.has_column("Stock Entry", "add_to_transit"):
|
|
|
|
frappe.db.sql("""
|
2021-08-19 08:11:10 +00:00
|
|
|
UPDATE `tabStock Entry` SET
|
2020-08-12 12:25:02 +00:00
|
|
|
stock_entry_type = 'Material Transfer',
|
|
|
|
purpose = 'Material Transfer',
|
|
|
|
add_to_transit = 1 WHERE stock_entry_type = 'Send to Warehouse'
|
|
|
|
""")
|
|
|
|
|
2021-08-19 08:11:10 +00:00
|
|
|
frappe.db.sql("""UPDATE `tabStock Entry` SET
|
2020-08-12 12:25:02 +00:00
|
|
|
stock_entry_type = 'Material Transfer',
|
|
|
|
purpose = 'Material Transfer'
|
|
|
|
WHERE stock_entry_type = 'Receive at Warehouse'
|
|
|
|
""")
|
2021-08-19 08:11:10 +00:00
|
|
|
|
2020-08-12 12:25:02 +00:00
|
|
|
frappe.reload_doc("stock", "doctype", "warehouse_type")
|
|
|
|
if not frappe.db.exists('Warehouse Type', 'Transit'):
|
|
|
|
doc = frappe.new_doc('Warehouse Type')
|
|
|
|
doc.name = 'Transit'
|
2020-08-17 05:50:56 +00:00
|
|
|
doc.insert()
|
|
|
|
|
|
|
|
frappe.reload_doc("stock", "doctype", "stock_entry_type")
|
|
|
|
frappe.delete_doc_if_exists("Stock Entry Type", "Send to Warehouse")
|
2021-08-19 08:11:10 +00:00
|
|
|
frappe.delete_doc_if_exists("Stock Entry Type", "Receive at Warehouse")
|