Skip to content

Commit 3ce6dcc

Browse files
rohitwaghchauremergify[bot]
authored andcommitted
fix: set default posting time in RIV
(cherry picked from commit a7ece65) (cherry picked from commit 1086a72)
1 parent 62448d9 commit 3ce6dcc

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def repost_now(self):
8080
repost(self)
8181

8282
def validate(self):
83+
self.set_default_posting_time()
8384
self.reset_repost_only_accounting_ledgers()
8485
self.set_company()
8586
self.validate_update_stock()
@@ -90,6 +91,13 @@ def validate(self):
9091
self.reset_recreate_stock_ledgers()
9192
self.validate_recreate_stock_ledgers()
9293

94+
def set_default_posting_time(self):
95+
if not self.posting_time:
96+
self.posting_time = nowtime()
97+
98+
if not self.posting_date:
99+
frappe.throw(_("Posting date is required"))
100+
93101
def reset_repost_only_accounting_ledgers(self):
94102
if self.repost_only_accounting_ledgers and self.based_on != "Transaction":
95103
self.repost_only_accounting_ledgers = 0

erpnext/stock/stock_ledger.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ def repost_future_sle(
237237

238238
index = get_current_index(doc) or 0
239239
while index < len(items_to_be_repost):
240+
validate_item_warehouse(items_to_be_repost[index])
241+
240242
obj = update_entries_after(
241243
{
242244
"item_code": items_to_be_repost[index].get("item_code"),

0 commit comments

Comments
 (0)