mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-20 15:32:14 +00:00
fix: Deadlock on submitting Sales Invoice (#41417)
(cherry picked from commit 4e4c1e4bef)
Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
@@ -93,11 +93,15 @@ class StockLedgerEntry(Document):
|
|||||||
self.validate_with_last_transaction_posting_time()
|
self.validate_with_last_transaction_posting_time()
|
||||||
self.validate_inventory_dimension_negative_stock()
|
self.validate_inventory_dimension_negative_stock()
|
||||||
|
|
||||||
def set_posting_datetime(self):
|
def set_posting_datetime(self, save=False):
|
||||||
from erpnext.stock.utils import get_combine_datetime
|
from erpnext.stock.utils import get_combine_datetime
|
||||||
|
|
||||||
self.posting_datetime = get_combine_datetime(self.posting_date, self.posting_time)
|
if save:
|
||||||
self.db_set("posting_datetime", self.posting_datetime)
|
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:
|
||||||
|
self.posting_datetime = get_combine_datetime(self.posting_date, self.posting_time)
|
||||||
|
|
||||||
def validate_inventory_dimension_negative_stock(self):
|
def validate_inventory_dimension_negative_stock(self):
|
||||||
if self.is_cancelled:
|
if self.is_cancelled:
|
||||||
@@ -169,7 +173,7 @@ class StockLedgerEntry(Document):
|
|||||||
return inv_dimension_dict
|
return inv_dimension_dict
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
self.set_posting_datetime()
|
self.set_posting_datetime(save=True)
|
||||||
self.check_stock_frozen_date()
|
self.check_stock_frozen_date()
|
||||||
|
|
||||||
# Added to handle few test cases where serial_and_batch_bundles are not required
|
# Added to handle few test cases where serial_and_batch_bundles are not required
|
||||||
|
|||||||
@@ -220,6 +220,7 @@ def make_entry(args, allow_negative_stock=False, via_landed_cost_voucher=False):
|
|||||||
sle.flags.ignore_permissions = 1
|
sle.flags.ignore_permissions = 1
|
||||||
sle.allow_negative_stock = allow_negative_stock
|
sle.allow_negative_stock = allow_negative_stock
|
||||||
sle.via_landed_cost_voucher = via_landed_cost_voucher
|
sle.via_landed_cost_voucher = via_landed_cost_voucher
|
||||||
|
sle.set_posting_datetime()
|
||||||
sle.submit()
|
sle.submit()
|
||||||
|
|
||||||
# Added to handle the case when the stock ledger entry is created from the repostig
|
# Added to handle the case when the stock ledger entry is created from the repostig
|
||||||
|
|||||||
Reference in New Issue
Block a user