2019-01-22 18:22:20 +05:30
|
|
|
from __future__ import unicode_literals
|
2015-08-10 17:04:07 +05:30
|
|
|
import frappe
|
2017-11-08 11:33:24 +05:30
|
|
|
from pymysql import InternalError
|
2015-08-10 17:04:07 +05:30
|
|
|
|
|
|
|
def execute():
|
2015-08-13 12:52:13 +05:30
|
|
|
frappe.reload_doctype("Journal Entry Account")
|
2015-08-10 17:04:07 +05:30
|
|
|
for doctype, fieldname in (
|
|
|
|
("Sales Order", "against_sales_order"),
|
|
|
|
("Purchase Order", "against_purchase_order"),
|
2015-08-12 14:33:46 +05:30
|
|
|
("Sales Invoice", "against_invoice"),
|
|
|
|
("Purchase Invoice", "against_voucher"),
|
2015-08-10 17:04:07 +05:30
|
|
|
("Journal Entry", "against_jv"),
|
|
|
|
("Expense Claim", "against_expense_claim"),
|
|
|
|
):
|
2015-08-14 12:17:34 +05:30
|
|
|
try:
|
|
|
|
frappe.db.sql("""update `tabJournal Entry Account`
|
|
|
|
set reference_type=%s, reference_name={0} where ifnull({0}, '') != ''
|
|
|
|
""".format(fieldname), doctype)
|
2017-11-08 11:33:24 +05:30
|
|
|
except InternalError:
|
2015-08-14 12:17:34 +05:30
|
|
|
# column not found
|
|
|
|
pass
|