Skip to content

Commit

Permalink
fix: slow posting datetime update
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitwaghchaure committed Dec 19, 2024
1 parent 90baa38 commit c72b4ff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def validate(self):
self.flags.ignore_submit_comment = True
from erpnext.stock.utils import validate_disabled_warehouse, validate_warehouse_company

self.set_posting_datetime()
self.validate_mandatory()
self.validate_batch()
validate_disabled_warehouse(self.warehouse)
Expand All @@ -101,11 +102,7 @@ def validate(self):
def set_posting_datetime(self, save=False):
from erpnext.stock.utils import get_combine_datetime

if save:
posting_datetime = get_combine_datetime(self.posting_date, self.posting_time)
if not self.posting_datetime or self.posting_datetime != posting_datetime:
self.db_set("posting_datetime", posting_datetime)
else:
if self.posting_date and self.posting_time:
self.posting_datetime = get_combine_datetime(self.posting_date, self.posting_time)

def validate_inventory_dimension_negative_stock(self):
Expand Down Expand Up @@ -173,7 +170,6 @@ def _get_inventory_dimensions(self):
return inv_dimension_dict

def on_submit(self):
self.set_posting_datetime(save=True)
self.check_stock_frozen_date()

# Added to handle few test cases where serial_and_batch_bundles are not required
Expand Down
1 change: 0 additions & 1 deletion erpnext/stock/stock_ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ def make_entry(args, allow_negative_stock=False, via_landed_cost_voucher=False):
sle.flags.ignore_permissions = 1
sle.allow_negative_stock = allow_negative_stock
sle.via_landed_cost_voucher = via_landed_cost_voucher
sle.set_posting_datetime()
sle.submit()

# Added to handle the case when the stock ledger entry is created from the repostig
Expand Down

0 comments on commit c72b4ff

Please sign in to comment.