fix: merge stock ledger item warehouse with doc's
This commit is contained in:
parent
e6ab8df8f2
commit
1022db0474
@ -13,7 +13,7 @@ from erpnext.accounts.utils import (
|
|||||||
check_if_stock_and_account_balance_synced,
|
check_if_stock_and_account_balance_synced,
|
||||||
update_gl_entries_after,
|
update_gl_entries_after,
|
||||||
)
|
)
|
||||||
from erpnext.stock.stock_ledger import repost_future_sle
|
from erpnext.stock.stock_ledger import get_items_to_be_repost, repost_future_sle
|
||||||
|
|
||||||
|
|
||||||
class RepostItemValuation(Document):
|
class RepostItemValuation(Document):
|
||||||
@ -138,13 +138,20 @@ def repost_gl_entries(doc):
|
|||||||
|
|
||||||
if doc.based_on == 'Transaction':
|
if doc.based_on == 'Transaction':
|
||||||
ref_doc = frappe.get_doc(doc.voucher_type, doc.voucher_no)
|
ref_doc = frappe.get_doc(doc.voucher_type, doc.voucher_no)
|
||||||
items, warehouses = ref_doc.get_items_and_warehouses()
|
doc_items, doc_warehouses = ref_doc.get_items_and_warehouses()
|
||||||
|
|
||||||
|
sles = get_items_to_be_repost(doc.voucher_type, doc.voucher_no)
|
||||||
|
sle_items = [sle.item_code for sle in sles]
|
||||||
|
sle_warehouse = [sle.warehouse for sle in sles]
|
||||||
|
|
||||||
|
items = list(set(doc_items).union(set(sle_items)))
|
||||||
|
warehouses = list(set(doc_warehouses).union(set(sle_warehouse)))
|
||||||
else:
|
else:
|
||||||
items = [doc.item_code]
|
items = [doc.item_code]
|
||||||
warehouses = [doc.warehouse]
|
warehouses = [doc.warehouse]
|
||||||
|
|
||||||
update_gl_entries_after(doc.posting_date, doc.posting_time,
|
update_gl_entries_after(doc.posting_date, doc.posting_time,
|
||||||
warehouses, items, company=doc.company)
|
for_warehouses=warehouses, for_items=items, company=doc.company)
|
||||||
|
|
||||||
def notify_error_to_stock_managers(doc, traceback):
|
def notify_error_to_stock_managers(doc, traceback):
|
||||||
recipients = get_users_with_role("Stock Manager")
|
recipients = get_users_with_role("Stock Manager")
|
||||||
|
Loading…
Reference in New Issue
Block a user