fix: set default posting time in RIV

(cherry picked from commit a7ece65536)
(cherry picked from commit 1086a72373)
This commit is contained in:
Rohit Waghchaure
2026-04-09 12:47:36 +05:30
committed by Mergify
parent 62448d98de
commit 3ce6dcc7a7
2 changed files with 10 additions and 0 deletions

View File

@@ -80,6 +80,7 @@ class RepostItemValuation(Document):
repost(self) repost(self)
def validate(self): def validate(self):
self.set_default_posting_time()
self.reset_repost_only_accounting_ledgers() self.reset_repost_only_accounting_ledgers()
self.set_company() self.set_company()
self.validate_update_stock() self.validate_update_stock()
@@ -90,6 +91,13 @@ class RepostItemValuation(Document):
self.reset_recreate_stock_ledgers() self.reset_recreate_stock_ledgers()
self.validate_recreate_stock_ledgers() self.validate_recreate_stock_ledgers()
def set_default_posting_time(self):
if not self.posting_time:
self.posting_time = nowtime()
if not self.posting_date:
frappe.throw(_("Posting date is required"))
def reset_repost_only_accounting_ledgers(self): def reset_repost_only_accounting_ledgers(self):
if self.repost_only_accounting_ledgers and self.based_on != "Transaction": if self.repost_only_accounting_ledgers and self.based_on != "Transaction":
self.repost_only_accounting_ledgers = 0 self.repost_only_accounting_ledgers = 0

View File

@@ -237,6 +237,8 @@ def repost_future_sle(
index = get_current_index(doc) or 0 index = get_current_index(doc) or 0
while index < len(items_to_be_repost): while index < len(items_to_be_repost):
validate_item_warehouse(items_to_be_repost[index])
obj = update_entries_after( obj = update_entries_after(
{ {
"item_code": items_to_be_repost[index].get("item_code"), "item_code": items_to_be_repost[index].get("item_code"),