From 3c364dd5b835af47bdb8c97e82ee162578e4997a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 1 Aug 2016 15:52:29 +0530 Subject: [PATCH] [patch] Update refdoc in Landed Cost Voucher --- erpnext/patches.txt | 1 + .../v7_0/update_refdoc_in_landed_cost_voucher.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 erpnext/patches/v7_0/update_refdoc_in_landed_cost_voucher.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 9eb2cccb4bc..97f5bd54683 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -306,3 +306,4 @@ erpnext.patches.v7_0.calculate_total_costing_amount 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 00000000000..2d562bb40ec --- /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