fix: recreate GL entry instead of repost

This commit is contained in:
Mihir Kandoi
2025-07-18 16:26:57 +05:30
parent b53723acad
commit cb02391f37

View File

@@ -13,14 +13,13 @@ def execute():
account, cost_center = frappe.db.get_values( account, cost_center = frappe.db.get_values(
"Subcontracting Receipt Item", item.reference_name, ["expense_account", "cost_center"] "Subcontracting Receipt Item", item.reference_name, ["expense_account", "cost_center"]
)[0] )[0]
if not item.expense_account: if not item.expense_account:
item.db_set("expense_account", account) item.db_set("expense_account", account)
if not item.cost_center: if not item.cost_center:
item.db_set("cost_center", cost_center) item.db_set("cost_center", cost_center)
repost_doc = frappe.new_doc("Repost Item Valuation")
repost_doc.voucher_type = "Subcontracting Receipt" doc.docstatus = 2
repost_doc.voucher_no = doc.name doc.make_gl_entries_on_cancel()
repost_doc.based_on = "Transaction" doc.docstatus = 1
repost_doc.company = doc.company doc.make_gl_entries()
repost_doc.save()
repost_doc.submit()