mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 16:34:46 +00:00
fix: missing account in GL entries (subcontracting)
This commit is contained in:
@@ -425,4 +425,5 @@ erpnext.patches.v15_0.rename_pos_closing_entry_fields #2025-06-13
|
|||||||
erpnext.patches.v15_0.update_pegged_currencies
|
erpnext.patches.v15_0.update_pegged_currencies
|
||||||
erpnext.patches.v15_0.set_status_cancelled_on_cancelled_pos_opening_entry_and_pos_closing_entry
|
erpnext.patches.v15_0.set_status_cancelled_on_cancelled_pos_opening_entry_and_pos_closing_entry
|
||||||
erpnext.patches.v15_0.set_company_on_pos_inv_merge_log
|
erpnext.patches.v15_0.set_company_on_pos_inv_merge_log
|
||||||
erpnext.patches.v15_0.rename_price_list_to_buying_price_list
|
erpnext.patches.v15_0.rename_price_list_to_buying_price_list
|
||||||
|
erpnext.patches.v15_0.repost_gl_entries_with_no_account_subcontracting
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import frappe
|
||||||
|
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
docs = frappe.get_all(
|
||||||
|
"GL Entry",
|
||||||
|
filters={"voucher_type": "Subcontracting Receipt", "account": ["is", "not set"], "is_cancelled": 0},
|
||||||
|
pluck="voucher_no",
|
||||||
|
)
|
||||||
|
for doc in docs:
|
||||||
|
doc = frappe.get_doc("Subcontracting Receipt", doc)
|
||||||
|
for item in doc.supplied_items:
|
||||||
|
if not item.expense_account:
|
||||||
|
account = frappe.get_value(
|
||||||
|
"Subcontracting Receipt Item", item.reference_name, "expense_account"
|
||||||
|
)
|
||||||
|
item.db_set("expense_account", account)
|
||||||
|
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()
|
||||||
Reference in New Issue
Block a user