[patch] Update refdoc in Landed Cost Voucher
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 9eb2ccc..97f5bd5 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -306,3 +306,4 @@
erpnext.patches.v7_0.fix_nonwarehouse_ledger_gl_entries_for_transactions
erpnext.patches.v7_0.remove_old_earning_deduction_doctypes
erpnext.patches.v7_0.make_guardian
+erpnext.patches.v7_0.update_refdoc_in_landed_cost_voucher
\ No newline at end of file
diff --git a/erpnext/patches/v7_0/update_refdoc_in_landed_cost_voucher.py b/erpnext/patches/v7_0/update_refdoc_in_landed_cost_voucher.py
new file mode 100644
index 0000000..2d562bb
--- /dev/null
+++ b/erpnext/patches/v7_0/update_refdoc_in_landed_cost_voucher.py
@@ -0,0 +1,15 @@
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+ if "purchase_receipt" not in frappe.db.get_table_columns("Landed Cost Purchase Receipt"):
+ return
+
+ frappe.reload_doctype("Landed Cost Purchase Receipt")
+
+ frappe.db.sql("""
+ update `tabLanded Cost Purchase Receipt`
+ set receipt_document_type = 'Purchase Receipt', receipt_document = purchase_receipt
+ where (receipt_document is null or receipt_document = '')
+ and (purchase_receipt is not null and purchase_receipt != '')
+ """)
\ No newline at end of file