diff --git a/erpnext/patches/v15_0/repost_gl_entries_with_no_account_subcontracting.py b/erpnext/patches/v15_0/repost_gl_entries_with_no_account_subcontracting.py index 7e06a4050d5..b2208667ea6 100644 --- a/erpnext/patches/v15_0/repost_gl_entries_with_no_account_subcontracting.py +++ b/erpnext/patches/v15_0/repost_gl_entries_with_no_account_subcontracting.py @@ -13,14 +13,13 @@ def execute(): account, cost_center = frappe.db.get_values( "Subcontracting Receipt Item", item.reference_name, ["expense_account", "cost_center"] )[0] + if not item.expense_account: item.db_set("expense_account", account) if not item.cost_center: item.db_set("cost_center", cost_center) - repost_doc = frappe.new_doc("Repost Item Valuation") - repost_doc.voucher_type = "Subcontracting Receipt" - repost_doc.voucher_no = doc.name - repost_doc.based_on = "Transaction" - repost_doc.company = doc.company - repost_doc.save() - repost_doc.submit() + + doc.docstatus = 2 + doc.make_gl_entries_on_cancel() + doc.docstatus = 1 + doc.make_gl_entries()